win32 rect fix

master
Henrique Santiago 13 years ago
parent caded3285c
commit dc409fe76c

@ -111,19 +111,20 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i
win32.minHeight = minHeight; win32.minHeight = minHeight;
win32.maximized = maximized; win32.maximized = maximized;
//AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle); RECT windowRect = {x, y, x + width, y + height};
AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
win32.window = CreateWindowExA(dwExStyle, // Extended Style For The Window
win32.appName.c_str(), // Class Name win32.window = CreateWindowExA(dwExStyle, // Extended Style For The Window
win32.appName.c_str(), // Window Title win32.appName.c_str(), // Class Name
dwStyle, // Required Window Style win32.appName.c_str(), // Window Title
x, // Window X Position dwStyle, // Required Window Style
y, // Window Y Position windowRect.left, // Window X Position
width, // Calculate Window Width windowRect.top, // Window Y Position
height, // Calculate Window Height windowRect.right - windowRect.left, // Calculate Window Width
NULL, // No Parent Window windowRect.bottom - windowRect.top, // Calculate Window Height
NULL, // No Menu NULL, // No Parent Window
win32.instance, // Instance NULL, // No Menu
win32.instance, // Instance
NULL); NULL);
if(!win32.window) { if(!win32.window) {
@ -314,6 +315,16 @@ int Platform::getWindowHeight()
return win32.height; return win32.height;
} }
int Platform::getDisplayWidth()
{
return GetSystemMetrics(SM_CXSCREEN);
}
int Platform::getDisplayHeight()
{
return GetSystemMetrics(SM_CYSCREEN);
}
bool Platform::isWindowMaximized() bool Platform::isWindowMaximized()
{ {
return win32.maximized; return win32.maximized;
@ -344,12 +355,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
minMax->ptMinTrackSize.y = win32.minHeight; minMax->ptMinTrackSize.y = win32.minHeight;
break; break;
} }
case WM_MOVING: case WM_MOVE:
case WM_SIZING:
{ {
RECT *rect = (RECT*)lParam; win32.x = LOWORD(lParam);
win32.x = rect->left; win32.y = HIWORD(lParam);
win32.y = rect->top;
break; break;
} }
case WM_SIZE: case WM_SIZE:

Loading…
Cancel
Save