浏览代码

Merge branch 'master' of https://github.com/blackberry/GamePlay

Sean Paul Taylor 13 年之前
父节点
当前提交
16eb89b6dc

+ 6 - 6
gameplay-encoder/README.md

@@ -31,11 +31,11 @@ XCode project "gameplay-encoder.xcodeproj" on MacOSX.
 - Edit the project properties of "gameplay-encoder" for Debug
 - Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
 - Add the FBX SDK include directory to Additional Include Directories (C++/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/include
+  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.2/include
 - Add the FBX lib directory to the Additional Library Directories (Linker/General)
-  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.1/lib/vs2010/x86
-- Add "fbxsdk-2013.1-mdd.lib"(Release) and "wininet.lib" to the Additional Dependencies (Linker/Input)
-  * Example: fbxsdk-2013.1-mdd.lib;wininet.lib
+  * Example: C:/Program Files/Autodesk/FBX/FbxSdk/2013.2/lib/vs2010/x86
+- Add "fbxsdk-2013.2-mdd.lib"(Release) to the Additional Dependencies (Linker/Input)
+  * Example: fbxsdk-2013.2-mdd.lib
 - Build gameplay-encoder
 
 ### Building with FBX Support on Mac OS X using XCode 4.3.2+
@@ -43,9 +43,9 @@ XCode project "gameplay-encoder.xcodeproj" on MacOSX.
 - Edit the project properties of target "gameplay-encoder".
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
 - Add the FBX include directory to Header Search Paths: (Build Settings)
-  * Example: /Applications/Autodesk/FBXSDK20131/include
+  * Example: "/Applications/Autodesk/FBX SDK/2013.2/include" (Use quotes due to additional space in path)
 - Add the FBX library and dependency Library/Frameworks: (Build Phases -> Link Binary with Libraries)
-  * Example: /Applications/Autodesk/FBXSDK20131/lib/gcc4/ub/libfbxsdk-2013.1-static.a  (Add Other)
+  * Example: /Applications/Autodesk/FBX SDK/2013.2/lib/gcc4/ub/libfbxsdk-2013.2-static.a  (Add Other)
   * Example: libiconv.dylib, Cocoa.framework, SystemConfiguration.framework
 - Build gameplay-encoder
 

+ 17 - 17
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -165,6 +165,14 @@ bool isGroupAnimationPossible(FbxScene* fbxScene);
 bool isGroupAnimationPossible(FbxNode* fbxNode);
 bool isGroupAnimationPossible(FbxMesh* fbxMesh);
 
+FbxAnimCurve* getCurve(FbxPropertyT<FbxDouble3>& prop, FbxAnimLayer* animLayer, const char* pChannel)
+{
+#if FBXSDK_VERSION_MAJOR == 2013 && FBXSDK_VERSION_MINOR == 1
+    return prop.GetCurve<FbxAnimCurve>(animLayer, pChannel);
+#else
+    return prop.GetCurve(animLayer, pChannel);
+#endif
+}
 
 ////////////////////////////////////
 // Member Functions
@@ -311,55 +319,55 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
     float startTime = FLT_MAX, stopTime = -1.0f, frameRate = -FLT_MAX;
     bool tx = false, ty = false, tz = false, rx = false, ry = false, rz = false, sx = false, sy = false, sz = false;
     FbxAnimCurve* animCurve = NULL;
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     {
         tx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     {
         ty = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclTranslation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclTranslation, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     {
         tz = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     {
         rx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     {
         ry = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclRotation.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclRotation, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     {
         rz = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_X);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_X);
     if (animCurve)
     {
         sx = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_Y);
     if (animCurve)
     {
         sy = true;
         findMinMaxTime(animCurve, &startTime, &stopTime, &frameRate);
     }
-    animCurve = fbxNode->LclScaling.GetCurve<FbxAnimCurve>(animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
+    animCurve = getCurve(fbxNode->LclScaling, animLayer, FBXSDK_CURVENODE_COMPONENT_Z);
     if (animCurve)
     {
         sz = true;
@@ -583,14 +591,6 @@ void FBXSceneEncoder::transformNode(FbxNode* fbxNode, Node* node)
 
     float m[16];
     copyMatrix(matrix, m);
-    int i = 0;
-    for (int row = 0; row < 4; ++row)
-    {
-        for (int col = 0; col < 4; ++col)
-        {
-            m[i++] = (float)matrix.Get(row, col);
-        }
-    }
     node->setTransformMatrix(m);
 }
 

+ 1 - 1
gameplay-newproject.sh

@@ -151,7 +151,7 @@ while [ "${gpPathAbs#$common_path}" = "${gpPathAbs}" ]; do
 		back="../${back}"
 	fi
 done
-gpPath=${back}${gpPathAbs#$common_path/}
+gpPath=${back}/${gpPathAbs#$common_path/}
 if [[ ${gpPathAbs} == ${common_path} ]]; then
 	gpPath=${back}
 fi

+ 31 - 25
gameplay/src/Button.cpp

@@ -38,43 +38,49 @@ bool Button::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contac
     switch (evt)
     {
     case Touch::TOUCH_PRESS:
-        if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-            y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+        if (_contactIndex == INVALID_CONTACT_INDEX)
         {
-            _contactIndex = (int) contactIndex;
+			if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+				y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+			{
+				_contactIndex = (int) contactIndex;
 
-            setState(Control::ACTIVE);
+				setState(Control::ACTIVE);
 
-            notifyListeners(Listener::PRESS);
+				notifyListeners(Listener::PRESS);
 
-            return _consumeInputEvents;
-        }
-        else
-        {
-            setState(Control::NORMAL);
+				return _consumeInputEvents;
+			}
+			else
+			{
+				setState(Control::NORMAL);
+			}
         }
         break;
 
     case Touch::TOUCH_RELEASE:
-        _contactIndex = INVALID_CONTACT_INDEX;
-        notifyListeners(Listener::RELEASE);
-        if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-            y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+        if (_contactIndex == (int) contactIndex)
         {
-            setState(Control::FOCUS);
-
-            notifyListeners(Listener::CLICK);
-
-            return _consumeInputEvents;
-        }
-        else
-        {
-            setState(Control::NORMAL);
+			_contactIndex = INVALID_CONTACT_INDEX;
+			notifyListeners(Listener::RELEASE);
+			if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+				y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+			{
+				setState(Control::FOCUS);
+
+				notifyListeners(Listener::CLICK);
+			}
+			else
+			{
+				setState(Control::NORMAL);
+			}
+			return _consumeInputEvents;
         }
         break;
-
     case Touch::TOUCH_MOVE:
-        return _consumeInputEvents;
+        if (_contactIndex == (int) contactIndex)
+            return _consumeInputEvents;
+        break;
     }
 
     return false;

+ 9 - 11
gameplay/src/CheckBox.cpp

@@ -84,17 +84,15 @@ bool CheckBox::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int cont
     switch (evt)
     {
     case Touch::TOUCH_RELEASE:
-        {
-            if (_state == Control::ACTIVE)
-            {
-                if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-                    y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
-                {
-                    _checked = !_checked;
-                    notifyListeners(Control::Listener::VALUE_CHANGED);
-                }
-            }
-        }
+		if (_contactIndex == (int) contactIndex && _state == Control::ACTIVE)
+		{
+			if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+				y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+			{
+				_checked = !_checked;
+				notifyListeners(Control::Listener::VALUE_CHANGED);
+			}
+		}
         break;
     }
 

+ 7 - 7
gameplay/src/Container.cpp

@@ -746,7 +746,7 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
 				_scrollBarOpacityClip = NULL;
 			}
 			_scrollBarOpacity = 1.0f;
-
+            _dirty = true;
 			return _consumeInputEvents;
     	}
 		break;
@@ -808,7 +808,7 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
                 _scrollingStartTimeY = gameTime;
 
             _scrollingLastTime = gameTime;
-
+            _dirty = true;
             return _consumeInputEvents;
         }
         break;
@@ -825,6 +825,7 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
 			{
 				_scrollingVelocity.set(0, 0);
 				_scrollingMouseVertically = _scrollingMouseHorizontally = false;
+                _dirty = true;
 				return _consumeInputEvents;
 			}
 
@@ -861,7 +862,7 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
 			}
 
 			_scrollingMouseVertically = _scrollingMouseHorizontally = false;
-
+            _dirty = true;
 			return _consumeInputEvents;
     	}
     	break;
@@ -940,6 +941,7 @@ bool Container::mouseEventScroll(Mouse::MouseEvent evt, int x, int y, int wheelD
                 _scrollBarOpacityClip = NULL;
             }
             _scrollBarOpacity = 1.0f;
+            _dirty = true;
             return _consumeInputEvents;
     }
 
@@ -986,12 +988,11 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
 
         Control::State currentState = control->getState();
         if ((control->isContainer() && currentState == Control::FOCUS) || 
-            (currentState != Control::NORMAL && control->_contactIndex == data) ||
+            (currentState != Control::NORMAL) ||// && control->_contactIndex == data) ||
             ((evt == Touch::TOUCH_PRESS ||
               evt == Mouse::MOUSE_PRESS_LEFT_BUTTON ||
               evt == Mouse::MOUSE_PRESS_MIDDLE_BUTTON ||
-              evt == Mouse::MOUSE_PRESS_RIGHT_BUTTON ||
-              evt == Mouse::MOUSE_WHEEL) &&
+              evt == Mouse::MOUSE_PRESS_RIGHT_BUTTON) &&
                 x >= xPos + boundsX &&
                 x <= xPos + boundsX + bounds.width &&
                 y >= yPos + boundsY &&
@@ -1045,7 +1046,6 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
         if ((mouse && mouseEventScroll((Mouse::MouseEvent)evt, x - xPos, y - yPos, data)) ||
             (!mouse && touchEventScroll((Touch::TouchEvent)evt, x - xPos, y - yPos, (unsigned int)data)))
         {
-            _dirty = true;
             eventConsumed = true;
         }
     }

+ 15 - 13
gameplay/src/Control.cpp

@@ -707,7 +707,7 @@ bool Control::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int conta
         // Controls that don't have an ACTIVE state go to the FOCUS state when pressed.
         // (Other controls, such as buttons and sliders, become ACTIVE when pressed and go to the FOCUS state on release.)
         // Labels are never any state other than NORMAL.
-        if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+        if (_contactIndex == INVALID_CONTACT_INDEX && x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
             y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
         {
             _contactIndex = (int) contactIndex;
@@ -720,26 +720,28 @@ bool Control::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int conta
         {
             // If this control was in focus, it's not any more.
             _state = NORMAL;
-            _contactIndex = INVALID_CONTACT_INDEX;
         }
         break;
             
     case Touch::TOUCH_RELEASE:
+        if (_contactIndex == (int)contactIndex)
+        {
+			_contactIndex = INVALID_CONTACT_INDEX;
 
-        _contactIndex = INVALID_CONTACT_INDEX;
+			// Always trigger Listener::RELEASE
+			notifyListeners(Listener::RELEASE);
 
-        // Always trigger Listener::RELEASE
-        notifyListeners(Listener::RELEASE);
+			// Only trigger Listener::CLICK if both PRESS and RELEASE took place within the control's bounds.
+			if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+				y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+			{
+				// Leave this control in the FOCUS state.
+				notifyListeners(Listener::CLICK);
+			}
 
-        // Only trigger Listener::CLICK if both PRESS and RELEASE took place within the control's bounds.
-        if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-            y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
-        {
-            // Leave this control in the FOCUS state.
-            notifyListeners(Listener::CLICK);
+			return _consumeInputEvents;
         }
-
-        return _consumeInputEvents;
+        break;
     }
 
     return false;

+ 1 - 1
gameplay/src/Form.cpp

@@ -168,7 +168,7 @@ Form* Form::create(const char* url)
     }
     form->initialize(style, formProperties);
 
-    form->_consumeInputEvents = formProperties->getBool("consumeInputs");
+    form->_consumeInputEvents = formProperties->getBool("consumeEvents");
 
     // Alignment
     if ((form->_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)

+ 93 - 79
gameplay/src/Joystick.cpp

@@ -123,101 +123,115 @@ bool Joystick::touchEvent(Touch::TouchEvent touchEvent, int x, int y, unsigned i
     {
         case Touch::TOUCH_PRESS:
         {
-            float dx = 0.0f;
-            float dy = 0.0f;
-
-            _contactIndex = (int) contactIndex;
-            notifyListeners(Listener::PRESS);
-
-            // Get the displacement of the touch from the centre.
-            if (!_relative)
-            {
-                dx = x - _screenRegion.width * 0.5f;
-                dy = _screenRegion.height * 0.5f - y;
-            }
-            else
+            if (_contactIndex == INVALID_CONTACT_INDEX)
             {
-                _screenRegion.x = x + _bounds.x - _screenRegion.width * 0.5f;
-                _screenRegion.y = y + _bounds.y - _screenRegion.height * 0.5f;
-            }
-
-            _displacement.set(dx, dy);
-
-            // If the displacement is greater than the radius, then cap the displacement to the
-            // radius.
+                float dx = 0.0f;
+                float dy = 0.0f;
+
+                _contactIndex = (int) contactIndex;
+                notifyListeners(Listener::PRESS);
+
+                // Get the displacement of the touch from the centre.
+                if (!_relative)
+                {
+                    dx = x - _screenRegion.width * 0.5f;
+                    dy = _screenRegion.height * 0.5f - y;
+                }
+                else
+                {
+                    _screenRegion.x = x + _bounds.x - _screenRegion.width * 0.5f;
+                    _screenRegion.y = y + _bounds.y - _screenRegion.height * 0.5f;
+                }
+
+                _displacement.set(dx, dy);
+
+                // If the displacement is greater than the radius, then cap the displacement to the
+                // radius.
             
-            Vector2 value;
-            if ((fabs(_displacement.x) > _radius) || (fabs(_displacement.y) > _radius))
-            {
-                _displacement.normalize();
-                value.set(_displacement);
-                _displacement.scale(_radius);
-            }
-            else
-            {
-                value.set(_displacement);
-                value.normalize();
-            }
-
-            // Check if the value has changed. Won't this always be the case?
-            if (_value != value)
-            {
-                _value.set(value);
-                _dirty = true;
-                notifyListeners(Listener::VALUE_CHANGED);
+                Vector2 value;
+                if ((fabs(_displacement.x) > _radius) || (fabs(_displacement.y) > _radius))
+                {
+                    _displacement.normalize();
+                    value.set(_displacement);
+                    _displacement.scale(_radius);
+                }
+                else
+                {
+                    value.set(_displacement);
+                    GP_ASSERT(_radius);
+                    value.scale(1.0f / _radius);
+                }
+
+                // Check if the value has changed. Won't this always be the case?
+                if (_value != value)
+                {
+                    _value.set(value);
+                    _dirty = true;
+                    notifyListeners(Listener::VALUE_CHANGED);
+                }
+
+                _state = ACTIVE;
+                return _consumeInputEvents;
             }
-
-            _state = ACTIVE;
-            return _consumeInputEvents;
+            break;
         }
         case Touch::TOUCH_MOVE:
         {
-            float dx = x - ((_relative) ? _screenRegion.x - _bounds.x : 0.0f) - _screenRegion.width * 0.5f;
-            float dy = -(y - ((_relative) ? _screenRegion.y - _bounds.y : 0.0f) - _screenRegion.height * 0.5f);
+            if (_contactIndex == (int) contactIndex)
+            {
+                float dx = x - ((_relative) ? _screenRegion.x - _bounds.x : 0.0f) - _screenRegion.width * 0.5f;
+                float dy = -(y - ((_relative) ? _screenRegion.y - _bounds.y : 0.0f) - _screenRegion.height * 0.5f);
             
-            _displacement.set(dx, dy);
+                _displacement.set(dx, dy);
             
-            Vector2 value;
-            if (fabs(_displacement.x) > _radius || fabs(_displacement.y) > _radius)
-            {
-                _displacement.normalize();
-                value.set(_displacement);
-                _displacement.scale(_radius);
-            }
-            else
-            {
-                value.set(_displacement);
-                value.normalize();
-            }
-
-            if (_value != value)
-            {
-                _value.set(value);
-                _dirty = true;
-                notifyListeners(Listener::VALUE_CHANGED);
+                Vector2 value;
+                if ((fabs(_displacement.x) > _radius) || (fabs(_displacement.y) > _radius))
+                {
+                    _displacement.normalize();
+                    value.set(_displacement);
+                    _displacement.scale(_radius);
+                }
+                else
+                {
+                    value.set(_displacement);
+                    GP_ASSERT(_radius);
+                    value.scale(1.0f / _radius);
+                }
+
+                if (_value != value)
+                {
+                    _value.set(value);
+                    _dirty = true;
+                    notifyListeners(Listener::VALUE_CHANGED);
+                }
+
+                return _consumeInputEvents;
             }
-
-            return _consumeInputEvents;
+            break;
         }
         case Touch::TOUCH_RELEASE:
         {
-            _contactIndex = INVALID_CONTACT_INDEX;
+            if (_contactIndex == (int) contactIndex)
+            {
+                _contactIndex = INVALID_CONTACT_INDEX;
 
-            notifyListeners(Listener::RELEASE);
+                notifyListeners(Listener::RELEASE);
 
-            // Reset displacement and direction vectors.
-            _displacement.set(0.0f, 0.0f);
-            Vector2 value(_displacement);
-            if (_value != value)
-            {
-                _value.set(value);
-                _dirty = true;
-                notifyListeners(Listener::VALUE_CHANGED);
-            }
+                // Reset displacement and direction vectors.
+                _displacement.set(0.0f, 0.0f);
+                Vector2 value(_displacement);
+                if (_value != value)
+                {
+                    _value.set(value);
+                    _dirty = true;
+                    notifyListeners(Listener::VALUE_CHANGED);
+                }
 
-            _state = NORMAL;
+                _state = NORMAL;
 
-            return _consumeInputEvents;
+                return _consumeInputEvents;
+            }
+            break;
         }
     }
 

+ 11 - 11
gameplay/src/RadioButton.cpp

@@ -93,18 +93,18 @@ bool RadioButton::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int c
     {
     case Touch::TOUCH_RELEASE:
         {
-            if (_state == Control::ACTIVE)
+            if (_contactIndex == (int) _contactIndex && _state == Control::ACTIVE)
             {
-                if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-                    y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
-                {
-                    if (!_selected)
-                    {
-                        RadioButton::clearSelected(_groupId);
-                        _selected = true;
-                        notifyListeners(Listener::VALUE_CHANGED);
-                    }
-                }
+				if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
+					y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
+				{
+					if (!_selected)
+					{
+						RadioButton::clearSelected(_groupId);
+						_selected = true;
+						notifyListeners(Listener::VALUE_CHANGED);
+					}
+				}
             }
         }
         break;

+ 15 - 7
gameplay/src/Slider.cpp

@@ -101,10 +101,16 @@ bool Slider::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contac
     switch (evt)
     {
     case Touch::TOUCH_PRESS:
+        if (_contactIndex != INVALID_CONTACT_INDEX)
+            return false;
         _state = Control::ACTIVE;
+        
         // Fall through to calculate new value.
     case Touch::TOUCH_MOVE:
-    case Touch::TOUCH_RELEASE:
+    
+        if (evt != Touch::TOUCH_PRESS && _contactIndex != (int)contactIndex)
+            return false;
+
         if (_state == ACTIVE &&
             x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
             y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
@@ -145,12 +151,14 @@ bool Slider::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contac
 
             _dirty = true;
         }
+        break;
+    case Touch::TOUCH_RELEASE:
 
-        if (evt == Touch::TOUCH_RELEASE)
-        {
-            _state = FOCUS;
-            _dirty = true;
-        }
+        if (_contactIndex != (int) contactIndex)// (evt == Touch::TOUCH_RELEASE)
+            return false;
+
+        _dirty = true;
+        _state = FOCUS;
         break;
     }
     
@@ -180,7 +188,7 @@ bool Slider::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
 
         case Mouse::MOUSE_WHEEL:
         {
-            if (_state == FOCUS)
+            if (_state == FOCUS || _state == ACTIVE)
             {
                 float total = _max - _min;
                 float oldValue = _value;