Parcourir la source

Updated xcode scheme to use LLDB instead of GDB

Sean Paul Taylor il y a 13 ans
Parent
commit
acbdf3a3a6

+ 13 - 0
.gitignore

@@ -85,6 +85,19 @@ Thumbs.db
 /gameplay-samples/sample03-character/res/shaders
 /gameplay-samples/sample03-character/res/shaders
 /gameplay-samples/sample03-character/res/logo_powered_white.png
 /gameplay-samples/sample03-character/res/logo_powered_white.png
 /gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
 /gameplay-samples/sample03-character/sample03-character.xcodeproj/xcuserdata
+/gameplay-samples/sample04-particles/Debug
+/gameplay-samples/sample04-particles/DebugMem
+/gameplay-samples/sample04-particles/Release
+/gameplay-samples/sample04-particles/Simulator
+/gameplay-samples/sample04-particles/Simulator-Coverage
+/gameplay-samples/sample04-particles/Simulator-Profile
+/gameplay-samples/sample04-particles/Device-Debug
+/gameplay-samples/sample04-particles/Device-Coverage
+/gameplay-samples/sample04-particles/Device-Profile
+/gameplay-samples/sample04-particles/Device-Release
+/gameplay-samples/sample04-particles/res/shaders
+/gameplay-samples/sample04-particles/res/logo_powered_white.png
+/gameplay-samples/sample04-particles/sample04-particles.xcodeproj/xcuserdata
 
 
 /gameplay-android/obj
 /gameplay-android/obj
 /gameplay-android/NUL
 /gameplay-android/NUL

+ 3 - 0
gameplay.xcworkspace/contents.xcworkspacedata

@@ -19,4 +19,7 @@
    <FileRef
    <FileRef
       location = "group:gameplay-samples/sample03-character/sample03-character.xcodeproj">
       location = "group:gameplay-samples/sample03-character/sample03-character.xcodeproj">
    </FileRef>
    </FileRef>
+   <FileRef
+      location = "group:gameplay-samples/sample04-particles/sample04-particles.xcodeproj">
+   </FileRef>
 </Workspace>
 </Workspace>

+ 10 - 9
gameplay/gameplay.xcodeproj/project.pbxproj

@@ -564,14 +564,14 @@
 		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
 		5B5DB93214C25BA5007755DB /* libvorbis.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbis.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbis.a"; sourceTree = "<group>"; };
 		5B5DB93314C25BA5007755DB /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
 		5B5DB93314C25BA5007755DB /* libvorbisenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisenc.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisenc.a"; sourceTree = "<group>"; };
 		5B5DB93414C25BA5007755DB /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
 		5B5DB93414C25BA5007755DB /* libvorbisfile.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvorbisfile.a; path = "../external-deps/oggvorbis/lib/ios/armv7/libvorbisfile.a"; sourceTree = "<group>"; };
-		5BAF201E152F2A6D003E2AC3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
-		5BAF2020152F2AF0003E2AC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2021152F2AF0003E2AC3 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2022152F2AF0003E2AC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2023152F2AF0003E2AC3 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2024152F2AF0003E2AC3 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2025152F2AF0003E2AC3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
-		5BAF2026152F2AF0003E2AC3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF201E152F2A6D003E2AC3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
+		5BAF2020152F2AF0003E2AC3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2021152F2AF0003E2AC3 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreMotion.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2022152F2AF0003E2AC3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2023152F2AF0003E2AC3 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2024152F2AF0003E2AC3 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2025152F2AF0003E2AC3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
+		5BAF2026152F2AF0003E2AC3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
 		5BB0823814C6FEB10019975F /* gameplay-main-android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "gameplay-main-android.cpp"; path = "src/gameplay-main-android.cpp"; sourceTree = SOURCE_ROOT; };
 		5BB0823814C6FEB10019975F /* gameplay-main-android.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "gameplay-main-android.cpp"; path = "src/gameplay-main-android.cpp"; sourceTree = SOURCE_ROOT; };
 		5BB0823914C6FEB10019975F /* PlatformAndroid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformAndroid.cpp; path = src/PlatformAndroid.cpp; sourceTree = SOURCE_ROOT; };
 		5BB0823914C6FEB10019975F /* PlatformAndroid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformAndroid.cpp; path = src/PlatformAndroid.cpp; sourceTree = SOURCE_ROOT; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };
 		5BB0823C14C6FEC40019975F /* Mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mouse.h; path = src/Mouse.h; sourceTree = SOURCE_ROOT; };
@@ -1400,6 +1400,7 @@
 		4234D99114686BB6003031B3 /* Debug */ = {
 		4234D99114686BB6003031B3 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
+				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = macosx;
 				SDKROOT = macosx;
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
 				SUPPORTED_PLATFORMS = "iphonesimulator macosx iphoneos";
 				VALID_ARCHS = "armv7 armv6 i386 x86_64";
 				VALID_ARCHS = "armv7 armv6 i386 x86_64";
@@ -1453,7 +1454,7 @@
 					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/macos\"",
 					"\"$(SRCROOT)/../external-deps/oggvorbis/lib/macos\"",
 				);
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				ONLY_ACTIVE_ARCH = NO;
+				ONLY_ACTIVE_ARCH = YES;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				PRODUCT_NAME = gameplay;
 				PRODUCT_NAME = gameplay;
 				SHARED_PRECOMPS_DIR = "";
 				SHARED_PRECOMPS_DIR = "";

+ 34 - 41
gameplay/src/PlatformMacOS.mm

@@ -19,8 +19,8 @@ using namespace gameplay;
 #define WINDOW_WIDTH    1280
 #define WINDOW_WIDTH    1280
 #define WINDOW_HEIGHT   720
 #define WINDOW_HEIGHT   720
 
 
-static const float ACCELEROMETER_X_FACTOR = 90.0f / WINDOW_WIDTH;
-static const float ACCELEROMETER_Y_FACTOR = 90.0f / WINDOW_HEIGHT;
+static const float ACCELEROMETER_FACTOR_X = 90.0f / WINDOW_WIDTH;
+static const float ACCELEROMETER_FACTOR_Y = 90.0f / WINDOW_HEIGHT;
 
 
 static long __timeStart;
 static long __timeStart;
 static long __timeAbsolute;
 static long __timeAbsolute;
@@ -35,6 +35,7 @@ static bool __rightMouseDown = false;
 static bool __otherMouseDown = false;
 static bool __otherMouseDown = false;
 static bool __shiftDown = false;
 static bool __shiftDown = false;
 
 
+
 long getMachTimeInMilliseconds()
 long getMachTimeInMilliseconds()
 {
 {
     static const int64_t kOneMillion = 1000 * 1000;
     static const int64_t kOneMillion = 1000 * 1000;
@@ -60,8 +61,6 @@ long getMachTimeInMilliseconds()
 @end
 @end
 
 
 
 
-static View* __view = NULL;
-
 @implementation View
 @implementation View
 
 
 -(void)windowWillClose:(NSNotification*)note 
 -(void)windowWillClose:(NSNotification*)note 
@@ -89,10 +88,10 @@ static View* __view = NULL;
 
 
     [[self openGLContext] makeCurrentContext];
     [[self openGLContext] makeCurrentContext];
     CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
     CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
-    
-    if (_game && _game->getState() == Game::RUNNING)  
+    if (_game && _game->getState() == Game::RUNNING)
+    {
         _game->frame();
         _game->frame();
-    
+    }
     CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
     CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
     CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);  
     CGLUnlockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);  
     
     
@@ -108,7 +107,6 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 
 
 - (id) initWithFrame: (NSRect) frame
 - (id) initWithFrame: (NSRect) frame
 {    
 {    
-
     NSOpenGLPixelFormatAttribute attrs[] = 
     NSOpenGLPixelFormatAttribute attrs[] = 
     {
     {
         NSOpenGLPFAAccelerated,
         NSOpenGLPFAAccelerated,
@@ -130,7 +128,6 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
         _game = Game::getInstance();
         _game = Game::getInstance();
         __timeStart = getMachTimeInMilliseconds();
         __timeStart = getMachTimeInMilliseconds();
     }
     }
-    
     return self;
     return self;
 }
 }
 
 
@@ -174,7 +171,6 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     // Release the display link
     // Release the display link
     CVDisplayLinkStop(displayLink);
     CVDisplayLinkStop(displayLink);
     CVDisplayLinkRelease(displayLink);
     CVDisplayLinkRelease(displayLink);
-    
     _game->exit();
     _game->exit();
     
     
     [lock unlock];
     [lock unlock];
@@ -182,13 +178,15 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     [super dealloc];
     [super dealloc];
 }
 }
 
 
-- (void)resumeDisplayRenderer {
+- (void)resumeDisplayRenderer 
+{
     [lock lock];
     [lock lock];
     CVDisplayLinkStop(displayLink);
     CVDisplayLinkStop(displayLink);
     [lock unlock]; 
     [lock unlock]; 
 }
 }
 
 
-- (void)haltDisplayRenderer {
+- (void)haltDisplayRenderer 
+{
     [lock lock];
     [lock lock];
     CVDisplayLinkStop(displayLink);
     CVDisplayLinkStop(displayLink);
     [lock unlock];
     [lock unlock];
@@ -198,9 +196,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 {
 {
     if (!Game::getInstance()->mouseEvent(mouseEvent, x, y, s))
     if (!Game::getInstance()->mouseEvent(mouseEvent, x, y, s))
     {
     {
-        Game::getInstance()->touchEvent(touchEvent, x, y, 0);
+        gameplay::Platform::touchEventInternal(touchEvent, x, y, 0);
     }
     }
-        
 }
 }
 
 
 - (void) mouseDown: (NSEvent*) event
 - (void) mouseDown: (NSEvent*) event
@@ -208,19 +205,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     NSPoint point = [event locationInWindow];
     NSPoint point = [event locationInWindow];
     __leftMouseDown = true;
     __leftMouseDown = true;
     [self mouse: Mouse::MOUSE_PRESS_LEFT_BUTTON orTouchEvent: Touch::TOUCH_PRESS atX: WINDOW_HEIGHT - point.x y: point.y s: 0];
     [self mouse: Mouse::MOUSE_PRESS_LEFT_BUTTON orTouchEvent: Touch::TOUCH_PRESS atX: WINDOW_HEIGHT - point.x y: point.y s: 0];
-
     
     
-    //_game->mouseEvent(Mouse::MOUSE_PRESS_LEFT_BUTTON, point.x, WINDOW_HEIGHT - point.y, 0);
-   /* 
-    MOUSE_PRESS_LEFT_BUTTON,
-    MOUSE_RELEASE_LEFT_BUTTON,
-    MOUSE_PRESS_MIDDLE_BUTTON,
-    MOUSE_RELEASE_MIDDLE_BUTTON,
-    MOUSE_PRESS_RIGHT_BUTTON,
-    MOUSE_RELEASE_RIGHT_BUTTON,
-    MOUSE_MOVE,
-    MOUSE_WHEEL
-*/
 }
 }
 
 
 - (void) mouseUp: (NSEvent*) event
 - (void) mouseUp: (NSEvent*) event
@@ -267,8 +252,8 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     if (__rightMouseDown)
     if (__rightMouseDown)
     {
     {
         // Update the pitch and roll by adding the scaled deltas.
         // Update the pitch and roll by adding the scaled deltas.
-        __roll += -(float)(point.x - __lx) * ACCELEROMETER_X_FACTOR;
-        __pitch -= (float)(point.y - (WINDOW_HEIGHT - __ly)) * ACCELEROMETER_Y_FACTOR;
+        __roll += -(float)(point.x - __lx) * ACCELEROMETER_FACTOR_X;
+        __pitch -= (float)(point.y - (WINDOW_HEIGHT - __ly)) * ACCELEROMETER_FACTOR_Y;
     
     
         // Clamp the values to the valid range.
         // Clamp the values to the valid range.
         __roll = max(min(__roll, 90.0f), -90.0f);
         __roll = max(min(__roll, 90.0f), -90.0f);
@@ -532,47 +517,48 @@ int getKey(unsigned short keyCode, unsigned int modifierFlags)
     switch (keyCode) 
     switch (keyCode) 
     {
     {
         case 0x39:
         case 0x39:
-            _game->keyEvent((flags & NSAlphaShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CAPS_LOCK);
+            gameplay::Platform::keyEventInternal((flags & NSAlphaShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CAPS_LOCK);
             break;
             break;
         case 0x38:
         case 0x38:
-            _game->keyEvent((flags & NSShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_SHIFT);
+            gameplay::Platform::keyEventInternal((flags & NSShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_SHIFT);
             break;
             break;
         case 0x3C:
         case 0x3C:
-            _game->keyEvent((flags & NSShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_SHIFT);
+            gameplay::Platform::keyEventInternal((flags & NSShiftKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_SHIFT);
             break;
             break;
         case 0x3A:
         case 0x3A:
-            _game->keyEvent((flags & NSAlternateKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_ALT);
+            gameplay::Platform::keyEventInternal((flags & NSAlternateKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_ALT);
             break;
             break;
         case 0x3D:
         case 0x3D:
-            _game->keyEvent((flags & NSAlternateKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_ALT);
+            gameplay::Platform::keyEventInternal((flags & NSAlternateKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_ALT);
             break;
             break;
         case 0x3B:
         case 0x3B:
-            _game->keyEvent((flags & NSControlKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CTRL);
+            gameplay::Platform::keyEventInternal((flags & NSControlKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CTRL);
             break;
             break;
         case 0x3E:
         case 0x3E:
-            _game->keyEvent((flags & NSControlKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CTRL);
+            gameplay::Platform::keyEventInternal((flags & NSControlKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_CTRL);
             break;
             break;
         case 0x37:
         case 0x37:
-            _game->keyEvent((flags & NSCommandKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_HYPER);
+            gameplay::Platform::keyEventInternal((flags & NSCommandKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_HYPER);
             break;
             break;
         case 0x36:
         case 0x36:
-            _game->keyEvent((flags & NSCommandKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_HYPER);
+            gameplay::Platform::keyEventInternal((flags & NSCommandKeyMask) ? Keyboard::KEY_PRESS : Keyboard::KEY_RELEASE, Keyboard::KEY_HYPER);
             break;
             break;
     }
     }
 }
 }
 
 
 - (void) keyDown: (NSEvent*) event
 - (void) keyDown: (NSEvent*) event
 {    
 {    
-    _game->keyEvent(Keyboard::KEY_PRESS, getKey([event keyCode], [event modifierFlags]));
+    gameplay::Platform::keyEventInternal(Keyboard::KEY_PRESS, getKey([event keyCode], [event modifierFlags]));
 }
 }
 
 
 - (void) keyUp: (NSEvent*) event
 - (void) keyUp: (NSEvent*) event
 {    
 {    
-    _game->keyEvent(Keyboard::KEY_RELEASE, getKey([event keyCode], [event modifierFlags]));
+    gameplay::Platform::keyEventInternal(Keyboard::KEY_RELEASE, getKey([event keyCode], [event modifierFlags]));
 }
 }
 
 
 @end
 @end
 
 
+static View* __view = NULL;
 
 
 namespace gameplay
 namespace gameplay
 {
 {
@@ -593,7 +579,6 @@ Platform::Platform(Game* game)
 
 
 Platform::Platform(const Platform& copy)
 Platform::Platform(const Platform& copy)
 {
 {
-    // hidden
 }
 }
 
 
 Platform::~Platform()
 Platform::~Platform()
@@ -638,7 +623,8 @@ int Platform::enterMessagePump()
     return EXIT_SUCCESS;
     return EXIT_SUCCESS;
 }
 }
 
 
-void Platform::signalShutdown() {
+void Platform::signalShutdown() 
+{
     [__view haltDisplayRenderer];
     [__view haltDisplayRenderer];
 
 
     // Don't perform terminate right away, enqueue to give game object
     // Don't perform terminate right away, enqueue to give game object
@@ -707,6 +693,13 @@ void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned
         Game::getInstance()->touchEvent(evt, x, y, contactIndex);
         Game::getInstance()->touchEvent(evt, x, y, contactIndex);
     }
     }
 }
 }
+    
+void Platform::keyEventInternal(Keyboard::KeyEvent evt, int key)
+{
+    gameplay::Game::getInstance()->keyEvent(evt, key);
+    Form::keyEventInternal(evt, key);
+}
+    
 
 
 void Platform::sleep(long ms)
 void Platform::sleep(long ms)
 {
 {

+ 2 - 10
gameplay/src/PlatformWin32.cpp

@@ -22,16 +22,9 @@ static HWND __hwnd = 0;
 static HDC __hdc = 0;
 static HDC __hdc = 0;
 static HGLRC __hrc = 0;
 static HGLRC __hrc = 0;
 
 
-// Gets the gameplay::Keyboard::Key enumeration constant that corresponds
-// to the given key and shift modifier combination.
+
 static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
 static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
 {
 {
-    // TODO: Handle the following keys
-    //gameplay::Keyboard::KEY_SYSREQ
-    //gameplay::Keyboard::KEY_BREAK
-    //gameplay::Keyboard::KEY_MENU
-    //gameplay::Keyboard::KEY_KP_ENTER
-
     switch (win32KeyCode)
     switch (win32KeyCode)
     {
     {
     case VK_PAUSE:
     case VK_PAUSE:
@@ -412,6 +405,7 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     return DefWindowProc(hwnd, msg, wParam, lParam); 
     return DefWindowProc(hwnd, msg, wParam, lParam); 
 }
 }
 
 
+
 namespace gameplay
 namespace gameplay
 {
 {
 
 
@@ -452,7 +446,6 @@ Platform::~Platform()
     }
     }
 }
 }
 
 
-// TODO: Fix Fullscreen + More error handling.
 Platform* Platform::create(Game* game)
 Platform* Platform::create(Game* game)
 {
 {
     FileSystem::setResourcePath("./");
     FileSystem::setResourcePath("./");
@@ -552,7 +545,6 @@ Platform* Platform::create(Game* game)
 
 
 error:
 error:
 
 
-    // TODO: cleanup
     exit(0);
     exit(0);
     return NULL;
     return NULL;
 }
 }

+ 22 - 22
gameplay/src/PlatformiOS.mm

@@ -20,14 +20,10 @@
 using namespace std;
 using namespace std;
 using namespace gameplay;
 using namespace gameplay;
 
 
-// UIScreen bounds are provided as if device was in portrait mode
-// Gameplay defaults to landscape
+// 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_WIDTH  = [[UIScreen mainScreen] bounds].size.height;
 extern const int WINDOW_HEIGHT = [[UIScreen mainScreen] bounds].size.width;
 extern const int WINDOW_HEIGHT = [[UIScreen mainScreen] bounds].size.width;
 
 
-static const float ACCELEROMETER_X_FACTOR = 90.0f / WINDOW_WIDTH;
-static const float ACCELEROMETER_Y_FACTOR = 90.0f / WINDOW_HEIGHT;
-
 @class AppDelegate;
 @class AppDelegate;
 @class View;
 @class View;
 
 
@@ -92,7 +88,6 @@ int getKey(unichar keyCode);
 {
 {
     if ((self = [super initWithFrame:frame]))
     if ((self = [super initWithFrame:frame]))
 	{
 	{
-        // Do a sanity check
         // A system version of 3.1 or greater is required to use CADisplayLink. 
         // A system version of 3.1 or greater is required to use CADisplayLink. 
 		NSString *reqSysVer = @"3.1";
 		NSString *reqSysVer = @"3.1";
 		NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
 		NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
@@ -122,8 +117,10 @@ int getKey(unichar keyCode);
 			return nil;
 			return nil;
 		}
 		}
 
 
-            if (!defaultFramebuffer)
-                [self createFramebuffer];
+        if (!defaultFramebuffer)
+        {
+            [self createFramebuffer];
+        }
             
             
         glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
         glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
         glViewport(0, 0, framebufferWidth, framebufferHeight);
         glViewport(0, 0, framebufferWidth, framebufferHeight);
@@ -157,7 +154,9 @@ int getKey(unichar keyCode);
     [self deleteFramebuffer];
     [self deleteFramebuffer];
     
     
 	if ([EAGLContext currentContext] == context)
 	if ([EAGLContext currentContext] == context)
+    {
         [EAGLContext setCurrentContext:nil];
         [EAGLContext setCurrentContext:nil];
+    }
 	[context release];
 	[context release];
     [super dealloc];
     [super dealloc];
 }
 }
@@ -203,7 +202,6 @@ int getKey(unichar keyCode);
 
 
 - (void)deleteFramebuffer
 - (void)deleteFramebuffer
 {
 {
-    // Deleting the framebuffer and all the buffers it contains
     if (context) 
     if (context) 
     {
     {
         [EAGLContext setCurrentContext:context];        
         [EAGLContext setCurrentContext:context];        
@@ -304,9 +302,6 @@ int getKey(unichar keyCode);
     return [self resignFirstResponder];
     return [self resignFirstResponder];
 }
 }
 
 
-/*
- * Virtual Keyboard Support
- */
 - (void)insertText:(NSString*)text 
 - (void)insertText:(NSString*)text 
 {
 {
     if([text length] == 0) return;
     if([text length] == 0) return;
@@ -328,17 +323,16 @@ int getKey(unichar keyCode);
     return YES;
     return YES;
 }
 }
 
 
-/*
- * Touch Support
- */
 - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event 
 - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event 
 {
 {
     unsigned int uniqueTouch = 0;
     unsigned int uniqueTouch = 0;
     for(UITouch *t in touches) 
     for(UITouch *t in touches) 
     {
     {
         CGPoint touchLoc = [t locationInView:self];
         CGPoint touchLoc = [t locationInView:self];
-        if(self.multipleTouchEnabled == YES) 
+        if(self.multipleTouchEnabled == YES)
+        {
             uniqueTouch = [t hash];
             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);
     }
     }
 }
 }
@@ -521,6 +515,7 @@ int getKey(unichar keyCode);
 
 
 @end
 @end
 
 
+
 long getMachTimeInMilliseconds()
 long getMachTimeInMilliseconds()
 {
 {
     static const int64_t kOneMillion = 1000 * 1000;
     static const int64_t kOneMillion = 1000 * 1000;
@@ -761,14 +756,12 @@ extern void printError(const char* format, ...)
     va_end(argptr);
     va_end(argptr);
 }
 }
 
 
-Platform::Platform(Game* game)
-    : _game(game)
+Platform::Platform(Game* game) : _game(game)
 {
 {
 }
 }
 
 
 Platform::Platform(const Platform& copy)
 Platform::Platform(const Platform& copy)
 {
 {
-    // hidden
 }
 }
 
 
 Platform::~Platform()
 Platform::~Platform()
@@ -790,7 +783,8 @@ int Platform::enterMessagePump()
     return EXIT_SUCCESS;
     return EXIT_SUCCESS;
 }
 }
     
     
-void Platform::signalShutdown() {
+void Platform::signalShutdown() 
+{
     // Cannot 'exit' an iOS Application
     // Cannot 'exit' an iOS Application
     assert(false);
     assert(false);
     [__view stopUpdating];
     [__view stopUpdating];
@@ -858,8 +852,14 @@ void Platform::displayKeyboard(bool display)
 {
 {
     if(__view) 
     if(__view) 
     {
     {
-        if(display) [__view showKeyboard];
-        else [__view dismissKeyboard];
+        if(display)
+        {
+            [__view showKeyboard];
+        }
+        else
+        {
+            [__view dismissKeyboard];
+        }
     }
     }
 }
 }