Browse Source

Merge branch 'next' of https://github.com/blackberry-gaming/GamePlay into next-dgough

Darryl Gough 13 years ago
parent
commit
55372ac18d

+ 3 - 2
README.md

@@ -2,8 +2,8 @@
 An open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
 
 ## Supported Mobile Platforms
-- BlackBerry PlayBook 2 (using BlackBerry Native SDK 2)
-- Google Android 2.3 (using Google Android NDK 7)
+- BlackBerry PlayBook 2.0 (using BlackBerry Native SDK 2)
+- Google Android 2.3 (using Google Android NDK r7, SDK API level 9 and up)
 - Apple iOS 5.1 (using Apple XCode 4.3.2)
 
 ## Supported Desktop Platforms
@@ -14,6 +14,7 @@ An open-source, cross-platform 3D native C++ game framework making it easy to le
 - Shadows
 - Lua Script Bindings
 - Terrain
+- AI
 - Editor
 - Performance/Optimizations
 

+ 2 - 0
gameplay-template/gameplay-template.vcxproj

@@ -76,6 +76,7 @@
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
@@ -107,6 +108,7 @@
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <ShowIncludes>false</ShowIncludes>
       <PreprocessToFile>false</PreprocessToFile>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

BIN
gameplay-template/res/box.gpb


+ 46 - 27
gameplay/src/PlatformQNX.cpp

@@ -778,6 +778,7 @@ int Platform::enterMessagePump()
     int domain;
     mtouch_event_t touchEvent;
     int touchId = 0;
+    bool suspended = false;
 
     // Get the initial time.
     clock_gettime(CLOCK_REALTIME, &__timespec);
@@ -950,6 +951,23 @@ int Platform::enterMessagePump()
                 case NAVIGATOR_SWIPE_DOWN:
                     _game->menu();
                     break;
+                case NAVIGATOR_WINDOW_STATE:
+                {
+                	navigator_window_state_t state = navigator_event_get_window_state(event);
+                	switch (state)
+                	{
+                	case NAVIGATOR_WINDOW_FULLSCREEN:
+                		_game->resume();
+                		suspended = false;
+                		break;
+                	case NAVIGATOR_WINDOW_THUMBNAIL:
+                	case NAVIGATOR_WINDOW_INVISIBLE:
+                		_game->pause();
+                		suspended = true;
+                		break;
+                	}
+                	break;
+                }
                 case NAVIGATOR_EXIT:
                     _game->exit();
                     break;
@@ -957,13 +975,11 @@ int Platform::enterMessagePump()
             }
             else if (domain == sensor_get_domain())
             {
-            	if (bps_event_get_code(event) == SENSOR_AZIMUTH_PITCH_ROLL_READING)
-            	{
-					float azimuth;
-					sensor_event_get_apr(event, &azimuth, &__pitch, &__roll);
-
-
-				   }
+                if (bps_event_get_code(event) == SENSOR_AZIMUTH_PITCH_ROLL_READING)
+                {
+                    float azimuth;
+                    sensor_event_get_apr(event, &azimuth, &__pitch, &__roll);
+                }
             }
         }
 
@@ -971,27 +987,30 @@ int Platform::enterMessagePump()
         if (_game->getState() == Game::UNINITIALIZED)
             break;
 
-        _game->frame();
-
-        // Post the new frame to the display.
-        // Note that there are a couple cases where eglSwapBuffers could fail
-        // with an error code that requires a certain level of re-initialization:
-        //
-        // 1) EGL_BAD_NATIVE_WINDOW - Called when the surface we're currently using
-        //    is invalidated. This would require us to destroy our EGL surface,
-        //    close our OpenKODE window, and start again.
-        //
-        // 2) EGL_CONTEXT_LOST - Power management event that led to our EGL context
-        //    being lost. Requires us to re-create and re-initalize our EGL context
-        //    and all OpenGL ES state.
-        //
-        // For now, if we get these, we'll simply exit.
-        rc = eglSwapBuffers(__eglDisplay, __eglSurface);
-        if (rc != EGL_TRUE)
+        if (!suspended)
         {
-            _game->exit();
-            perror("eglSwapBuffers");
-            break;
+            _game->frame();
+
+            // Post the new frame to the display.
+            // Note that there are a couple cases where eglSwapBuffers could fail
+            // with an error code that requires a certain level of re-initialization:
+            //
+            // 1) EGL_BAD_NATIVE_WINDOW - Called when the surface we're currently using
+            //    is invalidated. This would require us to destroy our EGL surface,
+            //    close our OpenKODE window, and start again.
+            //
+            // 2) EGL_CONTEXT_LOST - Power management event that led to our EGL context
+            //    being lost. Requires us to re-create and re-initalize our EGL context
+            //    and all OpenGL ES state.
+            //
+            // For now, if we get these, we'll simply exit.
+            rc = eglSwapBuffers(__eglDisplay, __eglSurface);
+            if (rc != EGL_TRUE)
+            {
+                _game->exit();
+                perror("eglSwapBuffers");
+                break;
+            }
         }
     }
 

+ 9 - 0
gameplay/src/ScreenDisplayer.h

@@ -14,6 +14,11 @@ class ScreenDisplayer
 {
 public:
 
+	/**
+	 * Constructor.
+	 */
+	ScreenDisplayer();
+
     /**
      * Displays a screen using the {@link Game#renderOnce} mechanism for at least the given amount of time.
      * 
@@ -35,6 +40,10 @@ private:
     long _startTime;
 };
 
+inline ScreenDisplayer::ScreenDisplayer() : _time(0L), _startTime(0L)
+{
+}
+
 template <typename T> void ScreenDisplayer::run(T* instance, void (T::*method) (void*), void* cookie, long time)
 {
     _time = time;

+ 2 - 1
gameplay/src/Transform.cpp

@@ -52,7 +52,7 @@ void Transform::resumeTransformChanged()
     if (_suspendTransformChanged == 0) // We haven't suspended transformChanged() calls, so do nothing.
         return;
     
-    if (--_suspendTransformChanged == 0)
+    if (_suspendTransformChanged == 1)
     {
         // Call transformChanged() on all transforms in the list
         unsigned int transformCount = _transformsChanged.size();
@@ -74,6 +74,7 @@ void Transform::resumeTransformChanged()
         // empty list for next frame.
         _transformsChanged.clear();
     }
+    _suspendTransformChanged--;
 }
 
 bool Transform::isTransformChangedSuspended()