layout codes of WinWindow.cpp

This commit is contained in:
hyzboy 2024-06-22 03:02:43 +08:00
parent 8d091ebfb0
commit 3b769e692b

View File

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