diff --git a/src/Platform/Win/WinWindow.cpp b/src/Platform/Win/WinWindow.cpp index b636b7fe..2475938c 100644 --- a/src/Platform/Win/WinWindow.cpp +++ b/src/Platform/Win/WinWindow.cpp @@ -2,34 +2,34 @@ namespace hgl { + LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + namespace { constexpr wchar_t WIN_CLASS_NAME[] = L"CMGameEngine/ULRE Window Class"; - } - LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + bool RegistryWinClass(HINSTANCE hInstance) + { + WNDCLASSEXW win_class; - bool WinWindow::Registry() - { - WNDCLASSEXW win_class; + hgl_zero(win_class); - hgl_zero(win_class); + win_class.cbSize = sizeof(WNDCLASSEXW); + win_class.style = CS_HREDRAW | CS_VREDRAW; + win_class.lpfnWndProc = WindowProc; + win_class.cbClsExtra = 0; + win_class.cbWndExtra = 0; + win_class.hInstance = hInstance; + win_class.hIcon = LoadIcon(nullptr, IDI_APPLICATION); + win_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + win_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); + win_class.lpszMenuName = nullptr; + win_class.lpszClassName = WIN_CLASS_NAME; + win_class.hIconSm = LoadIcon(nullptr, IDI_WINLOGO); - win_class.cbSize = sizeof(WNDCLASSEXW); - win_class.style = CS_HREDRAW | CS_VREDRAW; - win_class.lpfnWndProc = WindowProc; - win_class.cbClsExtra = 0; - win_class.cbWndExtra = 0; - win_class.hInstance = hInstance; - win_class.hIcon = LoadIcon(nullptr, IDI_APPLICATION); - win_class.hCursor = LoadCursor(nullptr, IDC_ARROW); - win_class.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); - win_class.lpszMenuName = nullptr; - win_class.lpszClassName = WIN_CLASS_NAME; - win_class.hIconSm = LoadIcon(nullptr, IDI_WINLOGO); - - return RegisterClassExW(&win_class); - } + return RegisterClassExW(&win_class); + } + }//namespace bool WinWindow::Create() { @@ -99,7 +99,7 @@ namespace hgl hInstance = GetModuleHandleW(nullptr); - if (!Registry()) + if (!RegistryWinClass(hInstance)) return(false); if(!Create()) diff --git a/src/Platform/Win/WinWindow.h b/src/Platform/Win/WinWindow.h index eb05b212..a44656ab 100644 --- a/src/Platform/Win/WinWindow.h +++ b/src/Platform/Win/WinWindow.h @@ -17,7 +17,6 @@ namespace hgl protected: - bool Registry(); bool Create(); void OnClose() override{Close();}