Browse Source

Merge branch 'master' of github.com:edubart/otclient

Eduardo Bart 10 years ago
parent
commit
2e5692da45
1 changed files with 27 additions and 18 deletions
  1. 27
    18
      src/framework/win32platform.cpp

+ 27
- 18
src/framework/win32platform.cpp View File

@@ -115,19 +115,20 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i
115 115
     win32.minHeight = minHeight;
116 116
     win32.maximized = maximized;
117 117
 
118
-    //AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
119
-
120
-    win32.window = CreateWindowExA(dwExStyle,		// Extended Style For The Window
121
-                                   win32.appName.c_str(),       // Class Name
122
-                                   win32.appName.c_str(),       // Window Title
123
-                                   dwStyle,		// Required Window Style
124
-                                   x,                   // Window X Position
125
-                                   y,                   // Window Y Position
126
-                                   width,               // Calculate Window Width
127
-                                   height,              // Calculate Window Height
128
-                                   NULL,		// No Parent Window
129
-                                   NULL,		// No Menu
130
-                                   win32.instance,	// Instance
118
+    RECT windowRect = {x, y, x + width, y + height};
119
+    AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
120
+
121
+    win32.window = CreateWindowExA(dwExStyle,                           // Extended Style For The Window
122
+                                   win32.appName.c_str(),               // Class Name
123
+                                   win32.appName.c_str(),               // Window Title
124
+                                   dwStyle,                             // Required Window Style
125
+                                   windowRect.left,                     // Window X Position
126
+                                   windowRect.top,                      // Window Y Position
127
+                                   windowRect.right - windowRect.left,  // Calculate Window Width
128
+                                   windowRect.bottom - windowRect.top,  // Calculate Window Height
129
+                                   NULL,		                // No Parent Window
130
+                                   NULL,		                // No Menu
131
+                                   win32.instance,                      // Instance
131 132
                                    NULL);
132 133
 
133 134
     if(!win32.window) {
@@ -318,6 +319,16 @@ int Platform::getWindowHeight()
318 319
     return win32.height;
319 320
 }
320 321
 
322
+int Platform::getDisplayWidth()
323
+{
324
+    return GetSystemMetrics(SM_CXSCREEN);
325
+}
326
+
327
+int Platform::getDisplayHeight()
328
+{
329
+    return GetSystemMetrics(SM_CYSCREEN);
330
+}
331
+
321 332
 bool Platform::isWindowMaximized()
322 333
 {
323 334
     return win32.maximized;
@@ -348,12 +359,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
348 359
             minMax->ptMinTrackSize.y = win32.minHeight;
349 360
             break;
350 361
         }
351
-    case WM_MOVING:
352
-    case WM_SIZING:
362
+    case WM_MOVE:
353 363
         {
354
-            RECT *rect = (RECT*)lParam;
355
-            win32.x = rect->left;
356
-            win32.y = rect->top;
364
+            win32.x = LOWORD(lParam);
365
+            win32.y = HIWORD(lParam);
357 366
             break;
358 367
         }
359 368
     case WM_SIZE:

Loading…
Cancel
Save