ソースを参照

Merge pull request #142 from blackberry-gaming/next

Next
Sean Paul Taylor 13 年 前
コミット
5e52f169e7

+ 2 - 1
CHANGES.md

@@ -5,7 +5,8 @@
 - User Interface support for scrolling with scrollbars on Container.
 - PVRTC, ATC and DXT texture compression support.
 - Performance improvements in user interface forms and text.
-- Performance improvements in animations on transforms.
+- Performance improvements in animations on transforms.
+- Performance improvements using NEON math for BlackBerry and iOS.
 - Fixes for improvements in error handling throughout all systems.
 - Fixes supporting built-in Maya COLLADA exporter via DAE_FBX export.
 - Fixes for latest FBX SDK 2013 support.

+ 2 - 2
README.md

@@ -3,7 +3,7 @@ An open-source, cross-platform 3D native C++ game framework making it easy to le
 
 ## Supported Mobile Platforms
 - BlackBerry 10 and PlayBook 2.0 (using BlackBerry Native SDK)
-- Google Android 2.3+ (using Google Android NDK r7, SDK API level 9+)
+- Google Android 2.3+ (using Google Android NDK, SDK API level 9+)
 - Apple iOS 5.1 (using Apple XCode 4.3.2)
 
 ## Supported Desktop Platforms
@@ -11,8 +11,8 @@ An open-source, cross-platform 3D native C++ game framework making it easy to le
 - Apple MacOS X (using Apple XCode 4.3.2)
 
 ## Roadmap for 'next' branch
-- Gamepad support
 - Lua script bindings
+- Gamepad support
 - Vehicle physics
 - Terrain
 - Lightmaps

+ 1 - 2
gameplay/src/AnimationClip.cpp

@@ -283,7 +283,7 @@ void AnimationClip::addListener(AnimationClip::Listener* listener, unsigned long
                 if (isClipStateBitSet(CLIP_IS_PLAYING_BIT))
                 {
                     unsigned long currentTime = _elapsedTime % _duration;
-                    GP_ASSERT(**_listenerItr);
+                    GP_ASSERT(**_listenerItr || *_listenerItr == _listeners->end());
                     if ((_speed >= 0.0f && currentTime < eventTime && (*_listenerItr == _listeners->end() || eventTime < (**_listenerItr)->_eventTime)) || 
                         (_speed <= 0 && currentTime > eventTime && (*_listenerItr == _listeners->begin() || eventTime > (**_listenerItr)->_eventTime)))
                         *_listenerItr = itr;
@@ -376,7 +376,6 @@ bool AnimationClip::update(unsigned long elapsedTime)
     if (_listeners)
     {
         GP_ASSERT(_listenerItr);
-        GP_ASSERT(**_listenerItr);
 
         if (_speed >= 0.0f)
         {

+ 0 - 1
gameplay/src/AnimationTarget.cpp

@@ -419,7 +419,6 @@ Animation::Channel* AnimationTarget::getChannel(const char* id) const
     if (_animationChannels)
     {
         std::vector<Animation::Channel*>::iterator itr = _animationChannels->begin();
-        GP_ASSERT(*itr);
 
         if (id == NULL)
             return (*itr);

+ 7 - 15
gameplay/src/Base.h

@@ -60,20 +60,9 @@ extern void printError(const char* format, ...);
 
 // Assert macros.
 #ifdef _DEBUG
-#ifdef WIN32
-#define GP_FORCE_ASSERTION_FAILURE do { __debugbreak(); } while (0)
-#else
-#define GP_FORCE_ASSERTION_FAILURE do { assert(0); } while (0)
-#endif
-#define GP_ASSERT(expression) do { \
-    if (!(expression)) \
-    { \
-        printError("%s -- Assertion '" #expression "' failed.\n", __current__func__); \
-        GP_FORCE_ASSERTION_FAILURE; \
-    } } while (0)
+#define GP_ASSERT(expression) assert(expression)
 #else
-#define GP_FORCE_ASSERTION_FAILURE do { (void)sizeof(int); } while (0)
-#define GP_ASSERT(expression) do { (void)sizeof(expression); } while (0)
+#define GP_ASSERT(expression)
 #endif
 
 // Error macro.
@@ -85,7 +74,7 @@ extern void printError(const char* format, ...);
         printError("%s -- ", __current__func__); \
         printError(__VA_ARGS__); \
         printError("\n"); \
-        GP_FORCE_ASSERTION_FAILURE; \
+        assert(0); \
         std::exit(-1); \
     } while (0)
 #endif
@@ -191,7 +180,7 @@ extern void printError(const char* format, ...);
     #define glClearDepth glClearDepthf
     #define OPENGL_ES
     #define USE_PVRTC
-    #ifdef __ARM__
+    #ifdef __arm__
         #define USE_NEON
     #endif
 #elif __ANDROID__
@@ -220,6 +209,9 @@ extern void printError(const char* format, ...);
         #define glClearDepth glClearDepthf
         #define OPENGL_ES
         #define USE_VAO
+        #ifdef __arm__
+            #define USE_NEON
+        #endif
     #elif TARGET_OS_MAC
         #include <OpenGL/gl.h>
         #include <OpenGL/glext.h>

+ 5 - 1
gameplay/src/Control.h

@@ -872,6 +872,11 @@ protected:
      */
     Rectangle _viewportClipBounds;
 
+    /**
+     * Previous frame's absolute clip bounds, to be cleared if necessary.
+     */
+    Rectangle _clearBounds;         
+
     /**
      * If the control is dirty and need updating.
      */
@@ -952,7 +957,6 @@ private:
     
     bool _styleOverridden;
     Theme::Skin* _skin;
-    Rectangle _clearBounds;         // Previous frame's absolute clip bounds, to be cleared if necessary.
 };
 
 }

+ 10 - 0
gameplay/src/Joystick.cpp

@@ -94,6 +94,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                 if (_value != value)
                 {
                     _value.set(value);
+                    _dirty = true;
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
 
@@ -114,6 +115,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                     if (_value != value)
                     {
                         _value.set(value);
+                        _dirty = true;
                         notifyListeners(Control::Listener::VALUE_CHANGED);
                     }
                 }
@@ -126,6 +128,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                     if (_value != value)
                     {
                         _value.set(value);
+                        _dirty = true;
                         notifyListeners(Control::Listener::VALUE_CHANGED);
                     }
                 }
@@ -146,6 +149,7 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
                 if (_value != value)
                 {
                     _value.set(value);
+                    _dirty = true;
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
 
@@ -161,6 +165,12 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
 void Joystick::update(const Control* container, const Vector2& offset)
 {
     Control::update(container, offset);
+
+    _clearBounds.x -= _radius;
+    _clearBounds.y -= _radius;
+    float radiusx2 = _radius + _radius;
+    _clearBounds.width += radiusx2;
+    _clearBounds.height += radiusx2;
 }
 
 void Joystick::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)

+ 5 - 5
gameplay/src/PlatformWin32.cpp

@@ -276,11 +276,6 @@ LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
     switch (msg)
     {
-    case WM_PAINT:
-        gameplay::Game::getInstance()->frame();
-        SwapBuffers(__hdc);
-        return 0;
-
     case WM_CLOSE:
         DestroyWindow(__hwnd);
         return 0;
@@ -663,6 +658,11 @@ int Platform::enterMessagePump()
                 break;
             }
         }
+        else
+        {
+            _game->frame();
+            SwapBuffers(__hdc);
+        }
 
         // If we are done, then exit.
         if (_game->getState() == Game::UNINITIALIZED)