Procházet zdrojové kódy

Fixed shutdown on Windows and added shutdownInternal on Platform.

setaylor před 13 roky
rodič
revize
5b9ca0c7e9

+ 2 - 2
gameplay/src/Base.h

@@ -279,9 +279,9 @@ typedef GLuint FrameBufferHandle;
 typedef GLuint RenderBufferHandle;
 
 /** Gamepad handle definitions vary by platform. */
-#if defined(__QNX__) && defined (USE_BLACKBERRY_GAMEPAD)
+#if defined(__QNX__) && defined(USE_BLACKBERRY_GAMEPAD)
     typedef screen_device_t GamepadHandle;
-#elif USE_XINPUT
+#elif defined(USE_XINPUT)
     typedef unsigned long GamepadHandle;
 #else
     typedef unsigned int GamepadHandle;

+ 7 - 0
gameplay/src/Platform.h

@@ -297,6 +297,13 @@ public:
      */
     static void pollGamepadState(Gamepad* gamepad);
 
+   /**
+     * Internal method used only from static code in various platform implementation.
+     *
+     * @script{ignore}
+     */
+    static void shutdownInternal();
+
 private:
 
     Game* _game;                // The game this platform is interfacing with.

+ 5 - 0
gameplay/src/PlatformAndroid.cpp

@@ -1263,6 +1263,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
 {
     // Pinch currently not implemented

+ 5 - 0
gameplay/src/PlatformBlackBerry.cpp

@@ -1532,6 +1532,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
 {
     // All are supported no need to test the bitset

+ 5 - 0
gameplay/src/PlatformLinux.cpp

@@ -1130,6 +1130,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
 {
     return false;

+ 5 - 0
gameplay/src/PlatformMacOSX.mm

@@ -1780,6 +1780,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
 {
     // Swipe unsupported as it is considered moving mouse cursor

+ 7 - 1
gameplay/src/PlatformWindows.cpp

@@ -354,6 +354,7 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         return 0;
 
     case WM_DESTROY:
+        gameplay::Platform::shutdownInternal();
         PostQuitMessage(0);
         return 0;
 
@@ -966,7 +967,7 @@ int Platform::enterMessagePump()
 
             if (msg.message == WM_QUIT)
             {
-                _game->exit();
+                gameplay::Platform::shutdownInternal();
                 return msg.wParam;
             }
         }
@@ -1291,6 +1292,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::launchURL(const char* url)
 {
     if (url == NULL || *url == '\0')

+ 5 - 0
gameplay/src/PlatformiOS.mm

@@ -1401,6 +1401,11 @@ void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
     Gamepad::remove(handle);
 }
 
+void Platform::shutdownInternal()
+{
+    Game::getInstance()->shutdown();
+}
+
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
 {
     return true;