Browse Source

[Mac|Win] Use current screen resolution if config specifies fullscreen and not width.

Corey Trampe 13 years ago
parent
commit
f8d86379fc
2 changed files with 16 additions and 0 deletions
  1. 9 0
      gameplay/src/PlatformMacOSX.mm
  2. 7 0
      gameplay/src/PlatformWin32.cpp

+ 9 - 0
gameplay/src/PlatformMacOSX.mm

@@ -7,6 +7,8 @@
 #include "Form.h"
 #include "ScriptController.h"
 #include <unistd.h>
+#include <IOKit/hid/IOHIDElement.h>
+#include <IOKit/hid/IOHIDDevice.h>
 #include <IOKit/hid/IOHIDLib.h>
 #import <Cocoa/Cocoa.h>
 #import <QuartzCore/CVDisplayLink.h>
@@ -1335,6 +1337,13 @@ int Platform::enterMessagePump()
 
             // Read fullscreen state.
             __fullscreen = config->getBool("fullscreen");
+            
+            // If fullscreen is specified, and width is not, interpret this
+            // as meaning, "use the current resolution".
+            if (__fullscreen && width == 0){
+			    __width = [[NSScreen mainScreen] frame].size.width;
+                __height = [[NSScreen mainScreen] frame].size.height;
+            }
         }
     }
 

+ 7 - 0
gameplay/src/PlatformWin32.cpp

@@ -893,6 +893,13 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         }
     }
 
+    // If fullscreen is specified, and width is not, interpret this
+    // as meaning, "use the current resolution".
+    if (params.fullscreen && params.rect.right == 0){
+        params.rect.right = params.rect.left + GetSystemMetrics(SM_CXSCREEN);
+        params.rect.bottom = params.rect.top + GetSystemMetrics(SM_CYSCREEN);
+    }
+    
     // If window size was not specified, set it to a default value
     if (params.rect.right == 0)
         params.rect.right = params.rect.left + DEFAULT_RESOLUTION_X;