Forráskód Böngészése

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

Steve Grenier 13 éve
szülő
commit
6ee09948df
3 módosított fájl, 16 hozzáadás és 7 törlés
  1. 1 6
      gameplay/src/Base.h
  2. 5 1
      gameplay/src/Control.h
  3. 10 0
      gameplay/src/Joystick.cpp

+ 1 - 6
gameplay/src/Base.h

@@ -62,12 +62,7 @@ extern void printError(const char* format, ...);
 
 // Assert macros.
 #ifdef _DEBUG
-#define GP_ASSERT(expression) do { \
-    if (!(expression)) \
-    { \
-        printError("%s -- Assertion '" #expression "' failed.\n", __current__func__); \
-        assert(expression); \
-    } } while (0)
+#define GP_ASSERT(expression) assert(expression)
 #else
 #define GP_ASSERT(expression)
 #endif

+ 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)