فهرست منبع

Merge pull request #135 from blackberry/next

Next
Sean Paul Taylor 14 سال پیش
والد
کامیت
a146f44b1d

+ 4 - 8
gameplay/src/Base.h

@@ -180,6 +180,10 @@ extern void printError(const char* format, ...);
 #define WINDOW_VSYNC        1
 #define WINDOW_FULLSCREEN   0
 
+// Display Properties
+extern const int WINDOW_WIDTH;
+extern const int WINDOW_HEIGHT;
+
 // Graphics (OpenGL)
 #if defined (__QNX__) || defined(__ANDROID__)
     #include <EGL/egl.h>
@@ -191,13 +195,9 @@ extern void printError(const char* format, ...);
     extern PFNGLISVERTEXARRAYOESPROC glIsVertexArray;
     #define glClearDepth glClearDepthf
     #define OPENGL_ES
-    #define WINDOW_WIDTH    1024
-    #define WINDOW_HEIGHT   600
 #elif WIN32
     #define WIN32_LEAN_AND_MEAN
     #include <GL/glew.h>
-    #define WINDOW_WIDTH    1024
-    #define WINDOW_HEIGHT   600
 #elif __APPLE__
     #include "TargetConditionals.h"
     #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
@@ -209,8 +209,6 @@ extern void printError(const char* format, ...);
         #define glIsVertexArray glIsVertexArrayOES
         #define glClearDepth glClearDepthf
         #define OPENGL_ES
-        #define WINDOW_WIDTH    480
-        #define WINDOW_HEIGHT   360
     #elif TARGET_OS_MAC
         #include <OpenGL/gl.h>
         #include <OpenGL/glext.h>
@@ -218,8 +216,6 @@ extern void printError(const char* format, ...);
         #define glDeleteVertexArrays glDeleteVertexArraysAPPLE
         #define glGenVertexArrays glGenVertexArraysAPPLE
         #define glIsVertexArray glIsVertexArrayAPPLE
-        #define WINDOW_WIDTH    960
-        #define WINDOW_HEIGHT   640
     #else
         #error "Unsupported Apple Device"
     #endif

+ 2 - 2
gameplay/src/PlatformiOS.mm

@@ -332,7 +332,7 @@ int getKey(unichar keyCode);
         CGPoint touchLoc = [t locationInView:self];
         if(self.multipleTouchEnabled == YES) 
             uniqueTouch = [t hash];
-        Game::getInstance()->touchEvent(Touch::TOUCH_PRESS, touchLoc.x,  touchLoc.y, uniqueTouch);
+        Game::getInstance()->touchEvent(Touch::TOUCH_PRESS, touchLoc.x, touchLoc.y, uniqueTouch);
     }
 }
 
@@ -362,7 +362,7 @@ int getKey(unichar keyCode);
         CGPoint touchLoc = [t locationInView:self];
         if(self.multipleTouchEnabled == YES) 
             uniqueTouch = [t hash];
-        Game::getInstance()->touchEvent(Touch::TOUCH_MOVE, touchLoc.x,  touchLoc.y, uniqueTouch);
+        Game::getInstance()->touchEvent(Touch::TOUCH_MOVE, touchLoc.x, touchLoc.y, uniqueTouch);
     }
 }
 

+ 7 - 1
gameplay/src/gameplay-main-ios.mm

@@ -1,14 +1,20 @@
 #ifdef __APPLE__
 
+#import <UIKit/UIKit.h>
 #include "gameplay.h"
 
 using namespace gameplay;
 
+// UIScreen bounds are provided as if device was in portrait mode
+// Gameplay defaults to landscape
+extern const int WINDOW_WIDTH  = [[UIScreen mainScreen] bounds].size.height;
+extern const int WINDOW_HEIGHT = [[UIScreen mainScreen] bounds].size.width;
+
 /**
  * Main entry point.
  */
 int main(int argc, char** argv)
-{
+{    
     Game* game = Game::getInstance();
     assert(game != NULL);
     Platform* platform = Platform::create(game);

+ 3 - 0
gameplay/src/gameplay-main-macos.mm

@@ -4,6 +4,9 @@
 
 using namespace gameplay;
 
+extern const int WINDOW_WIDTH  = 960;
+extern const int WINDOW_HEIGHT = 640;
+
 /**
  * Main entry point.
  */

+ 3 - 0
gameplay/src/gameplay-main-qnx.cpp

@@ -4,6 +4,9 @@
 
 using namespace gameplay;
 
+extern const int WINDOW_WIDTH  = 1024;
+extern const int WINDOW_HEIGHT = 600;
+
 /**
  * Main entry point.
  */

+ 3 - 0
gameplay/src/gameplay-main-win32.cpp

@@ -9,6 +9,9 @@ using namespace gameplay;
     #include <windows.h>
 #endif
 
+extern const int WINDOW_WIDTH  = 1024;
+extern const int WINDOW_HEIGHT = 600;
+
 /**
  * Main entry point.
  */