diff options
Diffstat (limited to 'deimos/core/os_win32.cpp')
-rw-r--r-- | deimos/core/os_win32.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/deimos/core/os_win32.cpp b/deimos/core/os_win32.cpp index e80a1d5..84fc3a3 100644 --- a/deimos/core/os_win32.cpp +++ b/deimos/core/os_win32.cpp @@ -95,6 +95,7 @@ class Win32WindowApiImpl : public OsWindowApi {
static constexpr wchar_t kClassName[] = L"Deimos window class";
+ HINSTANCE m_hinstance;
Allocator* m_allocator;
bool m_class_registered = false;
@@ -134,7 +135,7 @@ class Win32WindowApiImpl : public OsWindowApi WNDCLASSW wnd_class{};
wnd_class.lpfnWndProc = WindowProc;
- wnd_class.hInstance = ::GetModuleHandleW(nullptr);
+ wnd_class.hInstance = m_hinstance;
wnd_class.lpszClassName = kClassName;
::RegisterClassW(&wnd_class);
@@ -144,6 +145,7 @@ class Win32WindowApiImpl : public OsWindowApi public:
explicit Win32WindowApiImpl(Allocator* allocator) :
+ m_hinstance{::GetModuleHandleW(nullptr)},
m_allocator{allocator}
{}
@@ -163,7 +165,7 @@ public: HWND hwnd = ::CreateWindowExW(
0, kClassName, title_w, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- nullptr, nullptr, ::GetModuleHandle(nullptr), window);
+ nullptr, nullptr, m_hinstance, window);
if (hwnd == nullptr)
{
@@ -192,6 +194,18 @@ public: {
return window->quit_requested;
}
+
+#if DEIMOS_OS_WIN32
+ void* Win32Hwnd(const OsWindow* window) override
+ {
+ return std::bit_cast<void*>(window->hwnd);
+ }
+
+ void* Win32Hinstance(const OsWindow*) override
+ {
+ return std::bit_cast<void*>(m_hinstance);
+ }
+#endif
};
class Win32OsApiImpl : public OsApi
|