This commit is contained in:
hyzboy 2024-07-25 02:58:16 +08:00
commit d80802ce9e

View File

@ -10,9 +10,7 @@ namespace hgl
bool RegistryWinClass(HINSTANCE hInstance) bool RegistryWinClass(HINSTANCE hInstance)
{ {
WNDCLASSEXW win_class; WNDCLASSEXW win_class{};
hgl_zero(win_class);
win_class.cbSize = sizeof(WNDCLASSEXW); win_class.cbSize = sizeof(WNDCLASSEXW);
win_class.style = CS_HREDRAW | CS_VREDRAW; win_class.style = CS_HREDRAW | CS_VREDRAW;
@ -54,10 +52,10 @@ namespace hgl
if (width && height) if (width && height)
{ {
const uint32 screen_width=GetSystemMetrics(SM_CXSCREEN); const int screen_width =GetSystemMetrics(SM_CXSCREEN);
const uint32 screen_height=GetSystemMetrics(SM_CYSCREEN); const int screen_height=GetSystemMetrics(SM_CYSCREEN);
win_left = (screen_width - win_width) / 2; win_left = (screen_width - win_width ) / 2;
win_top = (screen_height - win_height) / 2; win_top = (screen_height - win_height) / 2;
} }
else else
@ -96,13 +94,13 @@ namespace hgl
bool WinWindow::Create(uint w, uint h) bool WinWindow::Create(uint w, uint h)
{ {
full_screen=false; full_screen = false;
width = w; width = w;
height = h; height = h;
hInstance = GetModuleHandleW(nullptr); hInstance = GetModuleHandleW(nullptr);
if (!RegistryWinClass(hInstance)) if(!RegistryWinClass(hInstance))
return(false); return(false);
if(!Create()) if(!Create())