Platform/Win32/Win32Display: minor fix.
This commit is contained in:
parent
04db63aa49
commit
f0d769c923
2 changed files with 9 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue