IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
windows.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/os/handle.hxx>
6
7#if ISP_WINDOWS
8
9#define WIN32_LEAN_AND_MEAN
10#define NOMINMAX
11#include <Windows.h>
12
13template<>
15{
18 using PlatformHandleType = HANDLE;
19
22 static constexpr PlatformHandleType InvalidHandle = INVALID_HANDLE_VALUE;
23
24 static bool is_valid(PlatformHandleType handle, void*) noexcept
25 {
26 return /*handle != nullptr &&*/ handle != InvalidHandle;
27 }
28
29 static bool close(PlatformHandleType handle, void*) noexcept
30 {
31 return CloseHandle(handle) != 0;
32 }
33};
34
35template<>
37{
38 using PlatformHandleType = HMODULE;
39
40 static constexpr PlatformHandleType InvalidHandle = NULL;
41
42 static bool is_valid(PlatformHandleType handle, void*) noexcept
43 {
44 return handle != InvalidHandle;
45 }
46
47 static bool close(PlatformHandleType handle, void*) noexcept
48 {
49 return FreeLibrary(handle) != 0;
50 }
51};
52
53namespace ice::win32
54{
55
56 using FileHandle = ice::os::Handle<ice::os::HandleType::File>;
57 using DynLibHandle = ice::os::Handle<ice::os::HandleType::DynLib>;
58
59} // namespace ice::win32
60
61#endif // ISP_WINDOWS
@ File
Definition handle.hxx:14
@ DynLib
Definition handle.hxx:15
SPDX-License-Identifier: MIT.
Definition array.hxx:12
Definition handle.hxx:26