diff --git a/source/Platform/Win32/Win32Display.cpp b/source/Platform/Win32/Win32Display.cpp index 885f5a4..57c0d0a 100644 --- a/source/Platform/Win32/Win32Display.cpp +++ b/source/Platform/Win32/Win32Display.cpp @@ -37,18 +37,18 @@ Win32Display::~Win32Display() bool Win32Display::create(DisplayDescription description) { DWORD flags = getWin32Flags(description.decoration); - int x, y; + Vector2i pos; if (firstTime) { registerClass(); firstTime = false; } - centerWindow(x, y, description.mode.width, description.mode.height); + pos = centerWindow(description.mode.width, description.mode.height); // Create window. m_handle = CreateWindowExA(0, WND_CLASSNAME, "", flags, - x, y, description.mode.width, description.mode.height, + pos.x, pos.y, description.mode.width, description.mode.height, NULL, NULL, GetModuleHandle(NULL), (LPVOID) this); if (!m_handle) { @@ -264,10 +264,12 @@ DWORD Win32Display::getWin32Flags(unsigned int flags) return win32_flags; } -void Win32Display::centerWindow(int &x, int &y, int width, int height) +Vector2i Win32Display::centerWindow(int width, int height) { - x = (::GetSystemMetrics(SM_CXSCREEN) - width) / 2; - y = (::GetSystemMetrics(SM_CYSCREEN) - height) / 2; + Vector2i v; + v.x = (::GetSystemMetrics(SM_CXSCREEN) - width) / 2; + v.y = (::GetSystemMetrics(SM_CYSCREEN) - height) / 2; + return v; } void Win32Display::processResizeMessage(const Vector2u& new_size) diff --git a/source/Platform/Win32/Win32Display.h b/source/Platform/Win32/Win32Display.h index 0e4ec85..80c7cc3 100644 --- a/source/Platform/Win32/Win32Display.h +++ b/source/Platform/Win32/Win32Display.h @@ -51,7 +51,7 @@ protected : DWORD getWin32Flags(unsigned int flags); - void centerWindow(int &x, int &y, int width, int height); + Vector2i centerWindow(int width, int height); void processMessage(UINT message, WPARAM wParam, LPARAM lParam);