source/Platform/Win32/Win32Display.cpp: in create() fix a bug where window size was initially not setup correctly causing two resize events.
This commit is contained in:
parent
ea4267ef2d
commit
fcc292a40f
1 changed files with 8 additions and 7 deletions
|
|
@ -42,20 +42,26 @@ Win32Display::~Win32Display()
|
||||||
bool Win32Display::create(DisplayDescription description)
|
bool Win32Display::create(DisplayDescription description)
|
||||||
{
|
{
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
Vector2i pos;
|
Vector2i pos, actual_size;
|
||||||
|
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
registerClass();
|
registerClass();
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the size for use later.
|
||||||
|
m_size = Vector2u(description.mode.width, description.mode.height);
|
||||||
|
|
||||||
// Set window to center and set decoration flags.
|
// Set window to center and set decoration flags.
|
||||||
pos = centerWindow(description.mode.width, description.mode.height);
|
pos = centerWindow(description.mode.width, description.mode.height);
|
||||||
flags = getWin32Flags(description.decoration);
|
flags = getWin32Flags(description.decoration);
|
||||||
|
|
||||||
|
// Calculate the actuall window size (with borders and stuff)
|
||||||
|
actual_size = calculateSize(flags, description.mode.width, description.mode.height);
|
||||||
|
|
||||||
// Create window.
|
// Create window.
|
||||||
m_handle = CreateWindowExA(0, WND_CLASSNAME, "", flags,
|
m_handle = CreateWindowExA(0, WND_CLASSNAME, "", flags,
|
||||||
pos.x, pos.y, description.mode.width, description.mode.height,
|
pos.x, pos.y, actual_size.x, actual_size.y,
|
||||||
NULL, NULL, GetModuleHandle(NULL), (LPVOID) this);
|
NULL, NULL, GetModuleHandle(NULL), (LPVOID) this);
|
||||||
|
|
||||||
if (!m_handle) {
|
if (!m_handle) {
|
||||||
|
|
@ -63,11 +69,6 @@ bool Win32Display::create(DisplayDescription description)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSize(description.mode.width, description.mode.height);
|
|
||||||
|
|
||||||
// Store the size for use later.
|
|
||||||
m_size = getSize();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue