2
0
Эх сурвалжийг харах

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

Conflicts:
	gameplay-tests/gameplay-tests.vcxproj
	gameplay-tests/gameplay-tests.vcxproj.filters
Dimitry Tomilovskiy 13 жил өмнө
parent
commit
b28a63561d
88 өөрчлөгдсөн 3137 нэмэгдсэн , 2640 устгасан
  1. 3 0
      .gitignore
  2. 0 1
      .kateconfig
  3. 16 3
      CHANGES.md
  4. 23 15
      README.md
  5. 0 8
      cmake/README.md
  6. 104 12
      gameplay-encoder/src/FBXSceneEncoder.cpp
  7. 5 0
      gameplay-luagen/src/Generator.cpp
  8. 1 1
      gameplay.doxyfile
  9. 9 7
      gameplay/.cproject
  10. 7 5
      gameplay/gameplay.vcxproj
  11. 6 6
      gameplay/gameplay.vcxproj.filters
  12. 2 0
      gameplay/src/AnimationClip.cpp
  13. 11 1
      gameplay/src/Base.h
  14. 20 1
      gameplay/src/Button.cpp
  15. 6 0
      gameplay/src/Button.h
  16. 1 1
      gameplay/src/Container.h
  17. 41 11
      gameplay/src/Control.cpp
  18. 34 11
      gameplay/src/Control.h
  19. 5 5
      gameplay/src/Font.cpp
  20. 11 2
      gameplay/src/Form.cpp
  21. 5 0
      gameplay/src/Form.h
  22. 2 2
      gameplay/src/Frustum.h
  23. 15 42
      gameplay/src/Game.cpp
  24. 1 42
      gameplay/src/Game.h
  25. 0 20
      gameplay/src/Game.inl
  26. 213 96
      gameplay/src/Gamepad.cpp
  27. 129 50
      gameplay/src/Gamepad.h
  28. 1 0
      gameplay/src/Joystick.cpp
  29. 3 0
      gameplay/src/Joystick.h
  30. 5 0
      gameplay/src/Joystick.inl
  31. 1 0
      gameplay/src/Layout.cpp
  32. 72 3
      gameplay/src/Matrix.cpp
  33. 63 31
      gameplay/src/Matrix.h
  34. 12 0
      gameplay/src/Node.cpp
  35. 5 5
      gameplay/src/Node.h
  36. 7 3
      gameplay/src/PhysicsCharacter.cpp
  37. 1 1
      gameplay/src/PhysicsCollisionObject.h
  38. 1 100
      gameplay/src/Platform.h
  39. 1 56
      gameplay/src/PlatformAndroid.cpp
  40. 207 59
      gameplay/src/PlatformBlackBerry.cpp
  41. 126 75
      gameplay/src/PlatformLinux.cpp
  42. 35 144
      gameplay/src/PlatformMacOSX.mm
  43. 148 325
      gameplay/src/PlatformWindows.cpp
  44. 1 57
      gameplay/src/PlatformiOS.mm
  45. 5 5
      gameplay/src/RenderState.h
  46. 2 2
      gameplay/src/Scene.h
  47. 1 1
      gameplay/src/ScriptController.h
  48. 8 7
      gameplay/src/SpriteBatch.cpp
  49. 3 3
      gameplay/src/Stream.h
  50. 1 1
      gameplay/src/Transform.h
  51. 1 1
      gameplay/src/Vector2.cpp
  52. 1 1
      gameplay/src/Vector2.h
  53. 1 1
      gameplay/src/Vector4.cpp
  54. 1 1
      gameplay/src/Vector4.h
  55. 111 66
      gameplay/src/lua/lua_Button.cpp
  56. 3 2
      gameplay/src/lua/lua_Button.h
  57. 111 66
      gameplay/src/lua/lua_CheckBox.cpp
  58. 3 2
      gameplay/src/lua/lua_CheckBox.h
  59. 110 66
      gameplay/src/lua/lua_Container.cpp
  60. 3 2
      gameplay/src/lua/lua_Container.h
  61. 110 66
      gameplay/src/lua/lua_Control.cpp
  62. 3 2
      gameplay/src/lua/lua_Control.h
  63. 110 66
      gameplay/src/lua/lua_Form.cpp
  64. 3 2
      gameplay/src/lua/lua_Form.h
  65. 0 121
      gameplay/src/lua/lua_Game.cpp
  66. 0 3
      gameplay/src/lua/lua_Game.h
  67. 205 63
      gameplay/src/lua/lua_Gamepad.cpp
  68. 9 5
      gameplay/src/lua/lua_Gamepad.h
  69. 123 0
      gameplay/src/lua/lua_GamepadButtonMapping.cpp
  70. 15 0
      gameplay/src/lua/lua_GamepadButtonMapping.h
  71. 0 33
      gameplay/src/lua/lua_GamepadButtonState.cpp
  72. 0 15
      gameplay/src/lua/lua_GamepadButtonState.h
  73. 23 5
      gameplay/src/lua/lua_Global.cpp
  74. 1 1
      gameplay/src/lua/lua_Global.h
  75. 146 66
      gameplay/src/lua/lua_Joystick.cpp
  76. 4 2
      gameplay/src/lua/lua_Joystick.h
  77. 110 66
      gameplay/src/lua/lua_Label.cpp
  78. 3 2
      gameplay/src/lua/lua_Label.h
  79. 164 0
      gameplay/src/lua/lua_Matrix.cpp
  80. 2 0
      gameplay/src/lua/lua_Matrix.h
  81. 41 478
      gameplay/src/lua/lua_Platform.cpp
  82. 1 12
      gameplay/src/lua/lua_Platform.h
  83. 111 66
      gameplay/src/lua/lua_RadioButton.cpp
  84. 3 2
      gameplay/src/lua/lua_RadioButton.h
  85. 110 66
      gameplay/src/lua/lua_Slider.cpp
  86. 3 2
      gameplay/src/lua/lua_Slider.h
  87. 110 66
      gameplay/src/lua/lua_TextBox.cpp
  88. 3 2
      gameplay/src/lua/lua_TextBox.h

+ 3 - 0
.gitignore

@@ -9,7 +9,9 @@ Icon?
 Thumbs.db
 /.metadata
 /169.254.0.1
+/usb
 /ipch
+/build
 /cmake
 /Debug
 /Release
@@ -45,6 +47,7 @@ Thumbs.db
 /gameplay/Device-Release
 /gameplay.xcworkspace/xcuserdata
 /gameplay/gameplay.xcodeproj/xcuserdata
+/gameplay/windows
 /gameplay/android/NUL
 /gameplay/android/proguard.cfg
 /gameplay/android/proguard-project.txt

+ 0 - 1
.kateconfig

@@ -1 +0,0 @@
-kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; show-tabs: on; replace-tabs-save: off; replace-trailing-space-save: off;

+ 16 - 3
CHANGES.md

@@ -1,13 +1,26 @@
 ## v1.6.0
-- Adds Stream interface for reading/writing files instead of using fread/fwrite. 
-- Android no longer needs to copy files to the SD card before reading them. None of the Android samples require an SD card.
+- Adds file Stream interface for reading/writing files instead of using fread/fwrite. 
+- Adds additional gameplay-tests for billboards and forms.
+- Adds support for launching the browser via launchURL(const char*).
+- Adds physics support for setLinearFactor and setAngularFactor  on rigid bodies.
+- Adds option for fullscreen without width/height config to use native desktop resolution.
+- Adds Linux support for OpenAL PulseAudio back-end.
+- Adds support for latest Bullet Physics 2.81 with NEON optimizations for mobile targets.
+- Adds Windows 7 64-bit support.
+- Fixes to external-deps to reduce the size of the libraries on Windows.
+- Fixes for Android to no longer need to copy files to the SD card before reading them. None of the Android samples require an SD card.
+- Fixes for animation of opacity on UI and fonts.
+- Fixes in UI for removing controls and also setVisible(bool)
+- Fixes for UI controls missing on MacOSX.
+- Fixes for setting UI alignment programmatically.
+- Fixes for directional and spotlight shaders.
 
 ## v1.5.0
 
 - Linux support. (tested on Ubuntu 12)
 - CMake support for makefile generation for Linux.
 - CodeBlocks 10 IDE support for Linux.
-- Gamepad controllers support for desktops.
+- Gamepad API support for desktops.
 - Touch gesture support for tap, swipe and pinch.
 - Vehicle physics support via new PhysicsVehicle and PhysicsVehicleWheel classes.
 - Adds new racer sample (sample06-racer).

+ 23 - 15
README.md

@@ -1,29 +1,37 @@
-## gameplay v1.5.0
-An open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
+## gameplay v1.6.0
+
+GamePlay3D is an open-source, cross-platform 3D native C++ game framework making it easy to learn and write mobile and desktop games. 
+
+<img align="right" src="https://raw.github.com/wiki/blackberry/GamePlay/img/logo.png" alt="gameplay" />
+
+- [Website](http://www.gameplay3d.org/)
+- [Forums](http://www.gameplay3d.org/forums/)
+- [Wiki](https://github.com/blackberry/GamePlay/wiki)
+- [API Reference](http://www.gameplay3d.org/api.php)
+- [Documentation](http://www.gameplay3d.org/docs.php)
 
 ## Supported Mobile Platforms
-- BlackBerry 10 and PlayBook 2.0 (using BlackBerry Native SDK)
-- Apple iOS 5.1 (using Apple XCode 4.3.2)
-- Google Android 2.3+ (using Google Android NDK, SDK API level 9+)
+- BlackBerry 10 and PlayBook (using [BlackBerry Native SDK](http://developer.blackberry.com/native/))
+- Apple iOS 5 (using Apple XCode 4)
+- Google Android 2.3+ (using Google Android NDK)
 
 ## Supported Desktop Platforms
 - Microsoft Windows 7 (using Microsoft Visual Studio 2010)
-- Apple MacOS X (using Apple XCode 4.3.2)
+- Apple MacOS X (using Apple XCode 4)
 - Linux (using CMake or CodeBlocks 10)
 
 ## Roadmap for 'next' branch
-- AI Pathfinding
-- Terrain and Water
-- Asset Pipeline improvements
+- [Version 1.7.0 Milestone](https://github.com/blackberry/GamePlay/issues?milestone=4)
 
 ## License
-The project is open sourced under the Apache 2.0 license.
+The project is open sourced under the [Apache 2.0 license](http://www.tldrlegal.com/license/apache-license-2.0-%28apache-2.0%29).
+
+## Bug Reporting
+Please log bugs under [Issues](https://github.com/blackberry/GamePlay/issues) on github.
+If you are unsure if your problem is a bug then post on the [Help Forum](http://www.gameplay3d.org/forums/viewforum.php?f=3).
 
-## Bug Reporting and Feature Requests
-If you find a bug in a Sample, or have an enhancement request, simply file an 
-[Issue](https://github.com/blackberry/GamePlay/issues) and send a message (via github messages) 
-to the Committers to the project to let them know that you have filed 
-an [Issue](https://github.com/blackberry/GamePlay/issues).
+## Feature Requests
+Please post feature requests on the [Feature Request Forum](http://www.gameplay3d.org/forums/viewforum.php?f=4). Approved feature requests will be added to the github issues list. 
 
 ## Disclaimer
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 

+ 0 - 8
cmake/README.md

@@ -1,8 +0,0 @@
-## Building with CMake
-Run the following command lines from this directory:
-* cmake ..
-* make
-
-
-
-

+ 104 - 12
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -54,27 +54,30 @@ static void loadNormal(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex,
  * 
  * @param fbxMesh The mesh to load from.
  * @param vertexIndex The index of the vertex within fbxMesh.
+ * @param controlPointIndex The control point index.
  * @param vertex The vertex to copy to.
  */
-static void loadTangent(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex);
+static void loadTangent(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex);
 
 /**
  * Loads the binormal from the mesh and adds it to the given vertex.
  * 
  * @param fbxMesh The mesh to load from.
  * @param vertexIndex The index of the vertex within fbxMesh.
+ * @param controlPointIndex The control point index.
  * @param vertex The vertex to copy to.
  */
-static void loadBinormal(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex);
+static void loadBinormal(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex);
 
 /**
  * Loads the vertex diffuse color from the mesh and adds it to the given vertex.
  * 
  * @param fbxMesh The mesh to load from.
  * @param vertexIndex The index of the vertex within fbxMesh.
+ * @param controlPointIndex The control point index.
  * @param vertex The vertex to copy to.
  */
-static void loadVertexColor(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex);
+static void loadVertexColor(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex);
 
 /**
  * Loads the blend weight and blend indices data into the vertex.
@@ -942,9 +945,9 @@ Mesh* FBXSceneEncoder::loadMesh(FbxMesh* fbxMesh)
 
             // Load other data
             loadNormal(fbxMesh, vertexIndex, controlPointIndex, &vertex);
-            loadTangent(fbxMesh, vertexIndex, &vertex);
-            loadBinormal(fbxMesh, vertexIndex, &vertex);
-            loadVertexColor(fbxMesh, vertexIndex, &vertex);
+            loadTangent(fbxMesh, vertexIndex, controlPointIndex, &vertex);
+            loadBinormal(fbxMesh, vertexIndex, controlPointIndex, &vertex);
+            loadVertexColor(fbxMesh, vertexIndex, controlPointIndex, &vertex);
 
             if (hasSkin)
             {
@@ -1234,13 +1237,41 @@ void loadNormal(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex
     }
 }
 
-void loadTangent(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex)
+void loadTangent(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex)
 {
     if (fbxMesh->GetElementTangentCount() > 0)
     {
         // Get only the first tangent
         FbxGeometryElementTangent* tangent = fbxMesh->GetElementTangent(0);
-        if (tangent->GetMappingMode() == FbxGeometryElement::eByPolygonVertex)
+        FbxGeometryElement::EMappingMode mappingMode = tangent->GetMappingMode();
+        if (mappingMode == FbxGeometryElement::eByControlPoint)
+        {
+            switch (tangent->GetReferenceMode())
+            {
+            case FbxGeometryElement::eDirect:
+                {
+                    FbxVector4 vec4 = tangent->GetDirectArray().GetAt(controlPointIndex);
+                    vertex->hasTangent = true;
+                    vertex->tangent.x = (float)vec4[0];
+                    vertex->tangent.y = (float)vec4[1];
+                    vertex->tangent.z = (float)vec4[2];
+                }
+                break;
+            case FbxGeometryElement::eIndexToDirect:
+                {
+                    int id = tangent->GetIndexArray().GetAt(controlPointIndex);
+                    FbxVector4 vec4 = tangent->GetDirectArray().GetAt(id);
+                    vertex->hasTangent = true;
+                    vertex->tangent.x = (float)vec4[0];
+                    vertex->tangent.y = (float)vec4[1];
+                    vertex->tangent.z = (float)vec4[2];
+                }
+                break;
+            default:
+                break;
+            }
+        }
+        else if (mappingMode == FbxGeometryElement::eByPolygonVertex)
         {
             switch (tangent->GetReferenceMode())
             {
@@ -1270,13 +1301,42 @@ void loadTangent(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex)
     }
 }
 
-void loadBinormal(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex)
+void loadBinormal(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex)
 {
     if (fbxMesh->GetElementBinormalCount() > 0)
     {
         // Get only the first binormal.
         FbxGeometryElementBinormal* binormal = fbxMesh->GetElementBinormal(0);
-        if (binormal->GetMappingMode() == FbxGeometryElement::eByPolygonVertex)
+        FbxGeometryElement::EMappingMode mappingMode = binormal->GetMappingMode();
+
+        if (mappingMode == FbxGeometryElement::eByControlPoint)
+        {
+            switch (binormal->GetReferenceMode())
+            {
+            case FbxGeometryElement::eDirect:
+                {
+                    FbxVector4 vec4 = binormal->GetDirectArray().GetAt(controlPointIndex);
+                    vertex->hasBinormal = true;
+                    vertex->binormal.x = (float)vec4[0];
+                    vertex->binormal.y = (float)vec4[1];
+                    vertex->binormal.z = (float)vec4[2];
+                }
+                break;
+            case FbxGeometryElement::eIndexToDirect:
+                {
+                    int id = binormal->GetIndexArray().GetAt(controlPointIndex);
+                    FbxVector4 vec4 = binormal->GetDirectArray().GetAt(id);
+                    vertex->hasBinormal = true;
+                    vertex->binormal.x = (float)vec4[0];
+                    vertex->binormal.y = (float)vec4[1];
+                    vertex->binormal.z = (float)vec4[2];
+                }
+                break;
+            default:
+                break;
+            }
+        }
+        else if (mappingMode == FbxGeometryElement::eByPolygonVertex)
         {
             switch (binormal->GetReferenceMode())
             {
@@ -1306,13 +1366,45 @@ void loadBinormal(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex)
     }
 }
 
-void loadVertexColor(FbxMesh* fbxMesh, int vertexIndex, Vertex* vertex)
+void loadVertexColor(FbxMesh* fbxMesh, int vertexIndex, int controlPointIndex, Vertex* vertex)
 {
     if (fbxMesh->GetElementVertexColorCount() > 0)
     {
         // Get only the first vertex color.
         FbxGeometryElementVertexColor* vertexColor = fbxMesh->GetElementVertexColor(0);
-        if (vertexColor->GetMappingMode() == FbxGeometryElement::eByPolygonVertex)
+        FbxGeometryElement::EMappingMode mappingMode = vertexColor->GetMappingMode();
+        if (mappingMode == FbxGeometryElement::eByControlPoint)
+        {
+            switch (vertexColor->GetReferenceMode())
+            {
+            case FbxGeometryElement::eDirect:
+                {
+                    FbxColor color = vertexColor->GetDirectArray().GetAt(controlPointIndex);
+
+                    vertex->hasDiffuse = true;
+                    vertex->diffuse.x = (float)color.mRed;
+                    vertex->diffuse.y = (float)color.mGreen;
+                    vertex->diffuse.z = (float)color.mBlue;
+                    vertex->diffuse.w = (float)color.mAlpha;
+                }
+                break;
+            case FbxGeometryElement::eIndexToDirect:
+                {
+                    int id = vertexColor->GetIndexArray().GetAt(controlPointIndex);
+                    FbxColor color = vertexColor->GetDirectArray().GetAt(id);
+
+                    vertex->hasDiffuse = true;
+                    vertex->diffuse.x = (float)color.mRed;
+                    vertex->diffuse.y = (float)color.mGreen;
+                    vertex->diffuse.z = (float)color.mBlue;
+                    vertex->diffuse.w = (float)color.mAlpha;
+                }
+                break;
+            default:
+                break;
+            }
+        }
+        else if (mappingMode == FbxGeometryElement::eByPolygonVertex)
         {
             switch (vertexColor->GetReferenceMode())
             {

+ 5 - 0
gameplay-luagen/src/Generator.cpp

@@ -443,6 +443,11 @@ void Generator::getClass(XMLElement* classNode, const string& name)
             if (_classes.find(parentClassName) != _classes.end())
                 classBinding.include = _classes[parentClassName].include;
         }
+        else
+        {
+            // Attempt to guess the name of the header.
+            classBinding.include = classBinding.classname + ".h";
+        }
     }
 
     // Track whether the class has any pure virtual functions.

+ 1 - 1
gameplay.doxyfile

@@ -32,7 +32,7 @@ PROJECT_NAME           = gameplay
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = 1.5.0
+PROJECT_NUMBER         = 1.6.0
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description 
 # for a project that appears at the top of each page and should give viewer 

+ 9 - 7
gameplay/.cproject

@@ -20,9 +20,10 @@
 							<builder buildPath="${workspace_loc:/gameplay/Device-Debug}" id="org.eclipse.cdt.build.core.internal.builder.159190287" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.build.core.internal.builder"/>
 							<tool id="com.qnx.qcc.tool.compiler.96907942" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.1765481355" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.311918799" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.311918799" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1481323494" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
+									<listOptionValue builtIn="false" value="__BB10__"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
 								</option>
 								<option id="com.qnx.qcc.option.compiler.includePath.2133604142" name="Include Directories (-I)" superClass="com.qnx.qcc.option.compiler.includePath" valueType="includePath">
@@ -42,6 +43,7 @@
 							</tool>
 							<tool id="com.qnx.qcc.tool.assembler.1988140188" name="QCC Assembler" superClass="com.qnx.qcc.tool.assembler">
 								<option id="com.qnx.qcc.option.assembler.debug.1929307156" name="Debug (-g)" superClass="com.qnx.qcc.option.assembler.debug" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.assembler.defines.1866459653" name="Defines (-D)" superClass="com.qnx.qcc.option.assembler.defines" valueType="definedSymbols"/>
 								<inputType id="com.qnx.qcc.inputType.assembler.1944074393" superClass="com.qnx.qcc.inputType.assembler"/>
 							</tool>
 							<tool id="com.qnx.qcc.tool.linker.85592747" name="QCC Linker" superClass="com.qnx.qcc.tool.linker">
@@ -82,7 +84,7 @@
 							<builder buildPath="${workspace_loc:/gameplay/Device-Release}" id="cdt.managedbuild.target.gnu.builder.base.1199322737" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
 							<tool id="com.qnx.qcc.tool.compiler.1345567866" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compiler.optlevel.1056793982" name="Optimization Level" superClass="com.qnx.qcc.option.compiler.optlevel" value="com.qnx.qcc.option.compiler.optlevel.1" valueType="enumerated"/>
-								<option id="com.qnx.qcc.option.compiler.security.324540233" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.324540233" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.398688299" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
@@ -143,7 +145,7 @@
 							<tool id="com.qnx.qcc.tool.compiler.1281156842" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.626405189" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.profile2.1207899085" name="Build for Profiling (Function Instrumentation) (-finstrument-functions)" superClass="com.qnx.qcc.option.compiler.profile2" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.1649809766" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.1649809766" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.276653249" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="BY_USE_NEON"/>
@@ -207,7 +209,7 @@
 							<tool id="com.qnx.qcc.tool.compiler.306557636" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.168813234" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.coverage.1032644527" name="Build for Code Coverage (-Wc,-ftest-coverage -Wc,-fprofile-arcs)" superClass="com.qnx.qcc.option.compiler.coverage" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.1227516972" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.1227516972" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.374283024" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 									<listOptionValue builtIn="false" value="BT_USE_NEON"/>
@@ -269,7 +271,7 @@
 							<builder buildPath="${workspace_loc:/gameplay/Simulator}" id="cdt.managedbuild.target.gnu.builder.base.10075032" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
 							<tool id="com.qnx.qcc.tool.compiler.1004416224" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.1122485646" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.1671403331" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.1671403331" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1863269886" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 								</option>
@@ -328,7 +330,7 @@
 							<tool id="com.qnx.qcc.tool.compiler.417488704" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.1290366598" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.profile2.216911941" name="Build for Profiling (Function Instrumentation) (-finstrument-functions)" superClass="com.qnx.qcc.option.compiler.profile2" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.1329750381" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.1329750381" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1679396285" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 								</option>
@@ -388,7 +390,7 @@
 							<tool id="com.qnx.qcc.tool.compiler.563072865" name="QCC Compiler" superClass="com.qnx.qcc.tool.compiler">
 								<option id="com.qnx.qcc.option.compile.debug.1789973550" name="Debug (-g)" superClass="com.qnx.qcc.option.compile.debug" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.coverage.1289221781" name="Build for Code Coverage (-Wc,-ftest-coverage -Wc,-fprofile-arcs)" superClass="com.qnx.qcc.option.compiler.coverage" value="true" valueType="boolean"/>
-								<option id="com.qnx.qcc.option.compiler.security.1296061040" name="Enhanced Security (-fstack-protector-all)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
+								<option id="com.qnx.qcc.option.compiler.security.1296061040" name="Enhanced Security (-fstack-protector-strong)" superClass="com.qnx.qcc.option.compiler.security" value="true" valueType="boolean"/>
 								<option id="com.qnx.qcc.option.compiler.defines.1925901823" name="Defines (-D)" superClass="com.qnx.qcc.option.compiler.defines" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_FORTIFY_SOURCE=2"/>
 								</option>

+ 7 - 5
gameplay/gameplay.vcxproj

@@ -149,7 +149,7 @@
     <ClCompile Include="src\lua\lua_Game.cpp" />
     <ClCompile Include="src\lua\lua_GameClearFlags.cpp" />
     <ClCompile Include="src\lua\lua_Gamepad.cpp" />
-    <ClCompile Include="src\lua\lua_GamepadButtonState.cpp" />
+    <ClCompile Include="src\lua\lua_GamepadButtonMapping.cpp" />
     <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp" />
     <ClCompile Include="src\lua\lua_GameState.cpp" />
     <ClCompile Include="src\lua\lua_Gesture.cpp" />
@@ -418,7 +418,7 @@
     <ClInclude Include="src\lua\lua_Game.h" />
     <ClInclude Include="src\lua\lua_GameClearFlags.h" />
     <ClInclude Include="src\lua\lua_Gamepad.h" />
-    <ClInclude Include="src\lua\lua_GamepadButtonState.h" />
+    <ClInclude Include="src\lua\lua_GamepadButtonMapping.h" />
     <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h" />
     <ClInclude Include="src\lua\lua_GameState.h" />
     <ClInclude Include="src\lua\lua_Gesture.h" />
@@ -871,7 +871,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>__BB10__;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
@@ -906,7 +906,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>USE_XINPUT;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -918,6 +918,8 @@
     <Lib>
       <Verbose>
       </Verbose>
+      <AdditionalDependencies>XInput.lib</AdditionalDependencies>
+      <AdditionalLibraryDirectories>C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86</AdditionalLibraryDirectories>
     </Lib>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
@@ -946,7 +948,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>__BB10__;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

+ 6 - 6
gameplay/gameplay.vcxproj.filters

@@ -660,9 +660,6 @@
     <ClCompile Include="src\lua\lua_GameClearFlags.cpp">
       <Filter>lua</Filter>
     </ClCompile>
-    <ClCompile Include="src\lua\lua_GamepadButtonState.cpp">
-      <Filter>lua</Filter>
-    </ClCompile>
     <ClCompile Include="src\lua\lua_GamepadGamepadEvent.cpp">
       <Filter>lua</Filter>
     </ClCompile>
@@ -819,6 +816,9 @@
     <ClCompile Include="src\lua\lua_Logger.cpp">
       <Filter>lua</Filter>
     </ClCompile>
+    <ClCompile Include="src\lua\lua_GamepadButtonMapping.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -1469,9 +1469,6 @@
     <ClInclude Include="src\lua\lua_GameClearFlags.h">
       <Filter>lua</Filter>
     </ClInclude>
-    <ClInclude Include="src\lua\lua_GamepadButtonState.h">
-      <Filter>lua</Filter>
-    </ClInclude>
     <ClInclude Include="src\lua\lua_GamepadGamepadEvent.h">
       <Filter>lua</Filter>
     </ClInclude>
@@ -1625,6 +1622,9 @@
     <ClInclude Include="src\Stream.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\lua\lua_GamepadButtonMapping.h">
+      <Filter>lua</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\Game.inl">

+ 2 - 0
gameplay/src/AnimationClip.cpp

@@ -449,6 +449,8 @@ bool AnimationClip::update(float elapsedTime)
     // then prevent a divide by zero and set percentComplete = 1.
     float percentComplete = _animation->_duration == 0 ? 1 : ((float)_startTime + currentTime) / (float)_animation->_duration;
     
+    percentComplete = MATH_CLAMP(percentComplete, 0.0f, 1.0f);
+
     if (isClipStateBitSet(CLIP_IS_FADING_OUT_BIT))
     {
         GP_ASSERT(_crossFadeToClip);

+ 11 - 1
gameplay/src/Base.h

@@ -187,9 +187,10 @@ using std::va_list;
 
 // Graphics (OpenGL)
 #ifdef __QNX__
-#include <EGL/egl.h>
+    #include <EGL/egl.h>
     #include <GLES2/gl2.h>
     #include <GLES2/gl2ext.h>
+    #include <screen/screen.h>
     extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray;
     extern PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays;
     extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays;
@@ -275,6 +276,15 @@ typedef GLuint TextureHandle;
 typedef GLuint FrameBufferHandle;
 /** Render buffer handle. */
 typedef GLuint RenderBufferHandle;
+
+/** Gamepad handle definitions vary by platform. */
+#ifdef __QNX__
+    typedef screen_device_t GamepadHandle;
+#elif USE_XINPUT
+    typedef unsigned long GamepadHandle;
+#else
+    typedef unsigned int GamepadHandle;
+#endif
 }
 
 /**

+ 20 - 1
gameplay/src/Button.cpp

@@ -1,10 +1,11 @@
 #include "Base.h"
 #include "Button.h"
+#include "Gamepad.h"
 
 namespace gameplay
 {
 
-Button::Button()
+Button::Button() : _dataBinding(0)
 {
 }
 
@@ -27,6 +28,14 @@ Button* Button::create(Theme::Style* style, Properties* properties)
     Button* button = new Button();
     button->initialize(style, properties);
 
+    // Different types of data bindings can be named differently in a button namespace.
+    // Gamepad button mappings have the name "mapping" and correspond to Gamepad::ButtonMapping enums.
+    const char* mapping = properties->getString("mapping");
+    if (mapping)
+    {
+        button->_dataBinding = Gamepad::getButtonMappingFromString(mapping);
+    }
+
     return button;
 }
 
@@ -92,4 +101,14 @@ const char* Button::getType() const
     return "button";
 }
 
+const unsigned int Button::getDataBinding() const
+{
+    return _dataBinding;
+}
+
+void Button::setDataBinding(unsigned int dataBinding)
+{
+    _dataBinding = dataBinding;
+}
+
 }

+ 6 - 0
gameplay/src/Button.h

@@ -90,6 +90,10 @@ protected:
      */
     const char* getType() const;
 
+    const unsigned int getDataBinding() const;
+
+    void setDataBinding(unsigned int dataBinding);
+
 private:
 
     /**
@@ -97,6 +101,8 @@ private:
      */
     Button(const Button& copy);
 
+    unsigned int _dataBinding;
+
 };
 
 }

+ 1 - 1
gameplay/src/Container.h

@@ -319,7 +319,7 @@ protected:
     void addControls(Theme* theme, Properties* properties);
 
     /**
-     * Draws a sprite batch for the specified clipping rect .
+     * Draws a sprite batch for the specified clipping rect.
      *
      * @param spriteBatch The sprite batch to use.
      * @param clip The clipping rectangle.

+ 41 - 11
gameplay/src/Control.cpp

@@ -7,7 +7,7 @@ namespace gameplay
 
 Control::Control()
     : _id(""), _state(Control::NORMAL), _bounds(Rectangle::empty()), _clipBounds(Rectangle::empty()), _viewportClipBounds(Rectangle::empty()),
-    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(true), _alignment(ALIGN_TOP_LEFT), _autoWidth(false), _autoHeight(false), _listeners(NULL),
+    _clearBounds(Rectangle::empty()), _dirty(true), _consumeInputEvents(true), _alignment(ALIGN_TOP_LEFT), _isAlignmentSet(false), _autoWidth(false), _autoHeight(false), _listeners(NULL), _visible(true),
     _contactIndex(INVALID_CONTACT_INDEX), _focusIndex(0), _parent(NULL), _styleOverridden(false), _skin(NULL)
 {
     addScriptEvent("controlEvent", "<Control>[Control::Listener::EventType]");
@@ -208,6 +208,7 @@ float Control::getHeight() const
 void Control::setAlignment(Alignment alignment)
 {
     _alignment = alignment;
+    _isAlignmentSet = true;
     _dirty = true;
 }
 
@@ -244,6 +245,27 @@ bool Control::getAutoHeight() const
     return _autoHeight;
 }
 
+void Control::setVisible(bool visible)
+{
+    if (visible && !_visible)
+    {
+        setEnabled(true);
+        _visible = true;
+        _dirty = true;
+    }
+    else if (!visible && _visible)
+    {
+        setEnabled(false);
+        _visible = false;
+        _dirty = true;
+    }
+}
+
+bool Control::isVisible() const
+{
+    return _visible;
+}
+
 void Control::setOpacity(float opacity, unsigned char states)
 {
     overrideStyle();
@@ -597,19 +619,21 @@ Control::State Control::getState() const
     return _state;
 }
 
-void Control::disable()
-{
-    _state = DISABLED;
-    _dirty = true;
-}
-
-void Control::enable()
+void Control::setEnabled(bool enabled)
 {
-    _state = NORMAL;
-    _dirty = true;
+	if (enabled && _state == Control::DISABLED)
+	{
+		_state = Control::NORMAL;
+		_dirty = true;
+	}
+	else if (!enabled && _state != Control::DISABLED)
+	{
+		_state = Control::DISABLED;
+		_dirty = true;
+	}
 }
 
-bool Control::isEnabled()
+bool Control::isEnabled() const
 {
     return _state != DISABLED;
 }
@@ -1019,6 +1043,9 @@ void Control::drawText(const Rectangle& position)
 
 void Control::draw(SpriteBatch* spriteBatch, const Rectangle& clip, bool needsClear, bool cleared, float targetHeight)
 {
+    if (!_visible)
+        return;
+
     if (needsClear)
     {
         GL_ASSERT( glEnable(GL_SCISSOR_TEST) );
@@ -1138,6 +1165,8 @@ void Control::getAnimationPropertyValue(int propertyId, AnimationValue* value)
         value->setFloat(0, _bounds.height);
         break;
     case ANIMATE_OPACITY:
+        value->setFloat(0, _opacity);
+        break;
     default:
         break;
     }
@@ -1176,6 +1205,7 @@ void Control::setAnimationPropertyValue(int propertyId, AnimationValue* value, f
         _dirty = true;
         break;
     case ANIMATE_OPACITY:
+        setOpacity(Curve::lerp(blendWeight, _opacity, value->getFloat(0)));
         _dirty = true;
         break;
     }

+ 34 - 11
gameplay/src/Control.h

@@ -590,6 +590,22 @@ public:
      */
     bool getTextRightToLeft(State state = NORMAL) const;
 
+    /**
+     * Sets the visibility of a control.
+     *
+     * This is a quick way to hide a control without having to remove it from a form.
+     *
+     * @param visible true if the control is visible and enabled; false if not-visible and disabled.
+     */
+    void setVisible(bool visible);
+
+    /**
+     * Get the visibility of a control.
+     *
+     * @return true if the control is visible; false if not visible.
+     */
+    bool isVisible() const;
+
     /**
      * Set the opacity of this control.
      *
@@ -636,22 +652,19 @@ public:
      */
     State getState() const;
 
-    /**
-     * Disable this control.
-     */
-    void disable();
-
-    /**
-     * Enable this control.
-     */
-    void enable();
+	/**
+	 * Enables/Disables a control. 
+	 *
+	 * @param enabled true if the control is enabled; false if disabled.
+	 */
+	void setEnabled(bool enabled);
 
     /**
      * Get whether this control is currently enabled.
      *
      * @return Whether this control is currently enabled.
      */
-    bool isEnabled();
+    bool isEnabled() const;
 
     /**
      * Set whether this control consumes input events,
@@ -854,7 +867,7 @@ protected:
     virtual void drawText(const Rectangle& clip);
 
     /**
-     * Draws a sprite batch for the specified clipping rect .
+     * Draws a sprite batch for the specified clipping rect.
      *
      * @param spriteBatch The sprite batch to use.
      * @param clip The clipping rectangle.
@@ -972,6 +985,11 @@ protected:
      * The Control's Alignment
      */
     Alignment _alignment;
+
+    /**
+     * Whether the Control's alignment has been set programmatically.
+     */
+    bool _isAlignmentSet;
     
     /**
      * Whether the Control's width is auto-sized.
@@ -993,6 +1011,11 @@ protected:
      */
     Theme::Style* _style;
 
+    /**
+     * The control is not visible and _state become DISABLED if false.
+     */
+    bool _visible;
+
     /**
      * The current opacity of the control.
      */

+ 5 - 5
gameplay/src/Font.cpp

@@ -30,7 +30,7 @@
     "void main()\n" \
     "{\n" \
         "gl_FragColor = v_color;\n" \
-        "gl_FragColor.a = texture2D(u_texture, v_texCoord).a;\n" \
+        "gl_FragColor.a = texture2D(u_texture, v_texCoord).a * v_color.a;\n" \
     "}"
 
 namespace gameplay
@@ -272,7 +272,7 @@ Font::Text* Font::createText(const char* text, const Rectangle& area, const Vect
         }
 
         bool draw = true;
-        if (yPos < area.y)
+        if (yPos < static_cast<int>(area.y))
         {
             // Skip drawing until line break or wrap.
             draw = false;
@@ -401,7 +401,7 @@ Font::Text* Font::createText(const char* text, const Rectangle& area, const Vect
                 size_t tokenLength = strcspn(token, "\n");
 
                 if (tokenLength > 0)
-                {                
+                {
                     // Get first token of next line.
                     token += tokenLength;
                 }
@@ -490,7 +490,7 @@ void Font::drawText(const char* text, int x, int y, const Vector4& color, unsign
 
         GP_ASSERT(_glyphs);
         GP_ASSERT(_batch);
-        for (size_t i = startIndex; i < length && i >= 0; i += (size_t)iteration)
+        for (size_t i = startIndex; i < length; i += (size_t)iteration)
         {
             char c = 0;
             if (rightToLeft)
@@ -629,7 +629,7 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
         }
 
         bool draw = true;
-        if (yPos < area.y - size)
+        if (yPos < static_cast<int>(area.y - size))
         {
             // Skip drawing until line break or wrap.
             draw = false;

+ 11 - 2
gameplay/src/Form.cpp

@@ -99,6 +99,8 @@ Form* Form::create(const char* id, Theme::Style* style, Layout::Type layoutType)
     Game* game = Game::getInstance();
     Matrix::createOrthographicOffCenter(0, game->getWidth(), game->getHeight(), 0, 0, 1, &form->_defaultProjectionMatrix);
 
+    form->updateBounds();
+
     __forms.push_back(form);
 
     return form;
@@ -200,6 +202,8 @@ Form* Form::create(const char* url)
     form->addControls(theme, formProperties);
 
     SAFE_DELETE(properties);
+    
+    form->updateBounds();
 
     __forms.push_back(form);
 
@@ -403,6 +407,11 @@ void Form::setNode(Node* node)
 }
 
 void Form::update(float elapsedTime)
+{
+    updateBounds();
+}
+
+void Form::updateBounds()
 {
     if (isDirty())
     {
@@ -552,7 +561,8 @@ void Form::draw()
 
         GP_ASSERT(_theme);
         _theme->setProjectionMatrix(_projectionMatrix);
-        Container::draw(_theme->getSpriteBatch(), Rectangle(0, 0, _bounds.width, _bounds.height), _skin != NULL, false, _bounds.height);
+        Container::draw(_theme->getSpriteBatch(), Rectangle(0, 0, _bounds.width, _bounds.height),
+                        true/*WAS _skin!=NULL*/, false, _bounds.height);
         _theme->setProjectionMatrix(_defaultProjectionMatrix);
 
         // Rebind the default framebuffer and game viewport.
@@ -710,7 +720,6 @@ bool Form::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelt
 bool Form::projectPoint(int x, int y, Vector3* point)
 {
     Scene* scene = _node->getScene();
-    GP_ASSERT(scene);
     Camera* camera;
 
     if (scene && (camera = scene->getActiveCamera()))

+ 5 - 0
gameplay/src/Form.h

@@ -183,6 +183,11 @@ private:
      */
     void initializeQuad(Mesh* mesh);
 
+    /**
+     * Update this form's bounds.
+     */
+    void updateBounds();
+
     /**
      * Propagate touch events to enabled forms.
      *

+ 2 - 2
gameplay/src/Frustum.h

@@ -114,7 +114,7 @@ public:
     void getCorners(Vector3* corners) const;
 
     /**
-     * Tests whether this frustum instersects the specified point.
+     * Tests whether this frustum intersects the specified point.
      *
      * @param point The point to test intersection with.
      *
@@ -123,7 +123,7 @@ public:
     bool intersects(const Vector3& point) const;
 
     /**
-     * Tests whether this frustum instersects the specified point.
+     * Tests whether this frustum intersects the specified point.
      *
      * @param x The x coordinate.
      * @param y The y coordinate.

+ 15 - 42
gameplay/src/Game.cpp

@@ -24,11 +24,10 @@ Game::Game()
       _clearDepth(1.0f), _clearStencil(0), _properties(NULL),
       _animationController(NULL), _audioController(NULL),
       _physicsController(NULL), _aiController(NULL), _audioListener(NULL),
-      _gamepads(NULL), _timeEvents(NULL), _scriptController(NULL), _scriptListeners(NULL)
+      _timeEvents(NULL), _scriptController(NULL), _scriptListeners(NULL)
 {
     GP_ASSERT(__gameInstance == NULL);
     __gameInstance = this;
-    _gamepads = new std::vector<Gamepad*>;
     _timeEvents = new std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >();
 }
 
@@ -112,9 +111,6 @@ bool Game::startup()
     RenderState::initialize();
     FrameBuffer::initialize();
 
-    // Load any gamepads, ui or physical.
-    loadGamepads();
-
     _animationController = new AnimationController();
     _animationController->initialize();
 
@@ -130,6 +126,9 @@ bool Game::startup()
     _scriptController = new ScriptController();
     _scriptController->initialize();
 
+    // Load any gamepads, ui or physical.
+    loadGamepads();
+
     // Set the script callback functions.
     if (_properties)
     {
@@ -183,16 +182,15 @@ void Game::shutdown()
         Platform::signalShutdown();
         finalize();
 
-
-        std::vector<Gamepad*>::iterator itr = _gamepads->begin();
-        std::vector<Gamepad*>::iterator end = _gamepads->end();
-        while (itr != end)
-        {
-            SAFE_DELETE(*itr);
-            itr++;
+        std::vector<Gamepad*>* gamepads = Gamepad::getGamepads(); 
+        if (gamepads) 
+        { 
+            for (size_t i = 0, count = gamepads->size(); i < count; ++i) 
+            { 
+                SAFE_DELETE((*gamepads)[i]); 
+            } 
+            gamepads->clear(); 
         }
-        _gamepads->clear();
-        SAFE_DELETE(_gamepads);
 
         _scriptController->finalizeGame();
 
@@ -273,7 +271,6 @@ void Game::frame()
         initialize();
         _scriptController->initializeGame();
         _initialized = true;
-        triggerGamepadEvents(); // Now that the game has been initialized, trigger any gamepad attached events.
     }
 
     if (_state == Game::RUNNING)
@@ -576,41 +573,17 @@ void Game::loadGamepads()
     // Load virtual gamepads.
     if (_properties)
     {
-        // Check if there is a virtual keyboard included in the .config file.
-        // If there is, try to create it and assign it to "player one".
+        // Check if there are any virtual gamepads included in the .config file.
+        // If there are, create and initialize them.
         Properties* gamepadProperties = _properties->getNamespace("gamepads", true);
-        unsigned int gamepadCount = 0;
         if (gamepadProperties && gamepadProperties->exists("form"))
         {
             const char* gamepadFormPath = gamepadProperties->getString("form");
             GP_ASSERT(gamepadFormPath);
-            Gamepad* gamepad = new Gamepad(gamepadCount, gamepadFormPath);
+            Gamepad* gamepad = Gamepad::add(gamepadFormPath);
             GP_ASSERT(gamepad);
-
-            _gamepads->push_back(gamepad);
-            gamepadCount++;
         }
     }
-
-    // Checks for any physical gamepads
-    getGamepadCount();
-}
-
-unsigned int Game::createGamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount)
-{
-    Gamepad* gamepad = new Gamepad(id, handle, buttonCount, joystickCount, triggerCount);
-    GP_ASSERT(gamepad);
-    _gamepads->push_back(gamepad);
-    return (unsigned int)(_gamepads->size() - 1);
-}
-
-void Game::triggerGamepadEvents()
-{
-    for (std::vector<Gamepad*>::iterator itr = _gamepads->begin(); itr != _gamepads->end(); itr++)
-    {
-        if ((*itr)->isConnected())
-            gamepadEvent(Gamepad::CONNECTED_EVENT, (*itr));
-    }
 }
 
 }

+ 1 - 42
gameplay/src/Game.h

@@ -441,29 +441,7 @@ public:
     virtual void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
 
     /**
-     * Gets the number of gamepad's that can be used in the game. Includes gamepads not connected.
-     * 
-     * @return The number of gamepad's that can be used in the game.
-     */
-    inline unsigned int getGamepadCount() const;
-
-    /**
-     * Gets the number of physical gamepad's attached/connected to the game.
-     * Can be called to detects if any gamepads have been attached or detached.
-     * 
-     * @return The number of gamepads attached to the Platform.
-     */
-    inline unsigned int getGamepadsConnected();
-
-    /**
-     * Gets the gamepad at the specified index.
-     *
-     * @param index The index to get the gamepad for: 0 <= index <= Game::getGamepadCount()
-     */
-    inline Gamepad* getGamepad(unsigned int index) const;
-
-    /**
-     * Sets muli-touch is to be enabled/disabled. Default is disabled.
+     * Sets multi-touch is to be enabled/disabled. Default is disabled.
      *
      * @param enabled true sets multi-touch is enabled, false to be disabled.
      */
@@ -654,24 +632,6 @@ private:
      */
     void loadGamepads();
 
-    /** 
-     * Creates a Gamepad object from a .form file.
-     *
-     * @param gamepadId The gamepad id (typically equal to the corresponding player's number).
-     * @param gamepadFormPath The path to the .form file.
-     */
-    Gamepad* createGamepad(const char* gamepadId, const char* gamepadFormPath);
-
-    /**
-     * Creates a Gamepad object for a physical gamepad.
-     */
-    unsigned int createGamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount);
-
-    /**
-     * Triggers any Gamepad::CONNECTED_EVENTS after initialization.
-     */
-    void triggerGamepadEvents();
-
     bool _initialized;                          // If game has initialized yet.
     State _state;                               // The game state.
     unsigned int _pausedCount;                  // Number of times pause() has been called.
@@ -692,7 +652,6 @@ private:
     PhysicsController* _physicsController;      // Controls the simulation of a physics scene and entities.
     AIController* _aiController;                // Controls AI simulation.
     AudioListener* _audioListener;              // The audio listener in 3D space.
-    std::vector<Gamepad*>* _gamepads;           // The connected gamepads.
     std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >* _timeEvents;     // Contains the scheduled time events.
     ScriptController* _scriptController;            // Controls the scripting engine.
     std::vector<ScriptListener*>* _scriptListeners; // Lua script listeners.

+ 0 - 20
gameplay/src/Game.inl

@@ -121,26 +121,6 @@ inline void Game::displayKeyboard(bool display)
     Platform::displayKeyboard(display);
 }
 
-inline unsigned int Game::getGamepadCount() const
-{
-    return (unsigned int)_gamepads->size();
-}
-
-inline unsigned int Game::getGamepadsConnected()
-{
-    return Platform::getGamepadsConnected();
-}
-
-inline Gamepad* Game::getGamepad(unsigned int index) const
-{
-    GP_ASSERT(index < _gamepads->size());
-
-    if (!_gamepads->empty())
-        return _gamepads->at(index);
-    else
-        return NULL;
-}
-
 inline bool Game::launchURL(const char* url) const
 {
     return Platform::launchURL(url);

+ 213 - 96
gameplay/src/Gamepad.cpp

@@ -1,30 +1,105 @@
 #include "Base.h"
 #include "Gamepad.h"
 #include "Game.h"
+#include "Button.h"
 
 namespace gameplay
 {
 
-Gamepad::Gamepad(unsigned int handle, const char* formPath)
-    : _id(""), _handle(handle), _buttonCount(0), _joystickCount(0), _triggerCount(0), _gamepadForm(NULL),
-      _uiJoysticks(NULL), _uiButtons(NULL)
+static std::vector<Gamepad*> __gamepads;
+
+Gamepad::Gamepad(const char* formPath)
+    : _id(""), _handle(0), _vendorId(0), _productId(0), _buttonCount(0), _joystickCount(0), _triggerCount(0), _form(NULL)
 {
     GP_ASSERT(formPath);
+    _form = Form::create(formPath);
+    GP_ASSERT(_form);
+    _form->setConsumeInputEvents(false);
+    _id = _form->getId();
+    _vendorString = "GamePlay";
+    _productString = "Virtual Gamepad";
 
-    _gamepadForm = Form::create(formPath);
-    GP_ASSERT(_gamepadForm);
+    for (int i = 0; i < 2; ++i)
+    {
+        _uiJoysticks[i] = NULL;
+    }
 
-    _gamepadForm->setConsumeInputEvents(false);
+    for (int i = 0; i < 20; ++i)
+    {
+        _uiButtons[i] = NULL;
+    }
 
-    _id = _gamepadForm->getId();
+    bindGamepadControls(_form);
+}
 
-    bindGamepadControls(_gamepadForm);
+Gamepad::Gamepad(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                 unsigned int vendorId, unsigned int productId, char* vendorString, char* productString)
+    : _id(id), _handle(handle), _vendorId(vendorId), _productId(productId), _vendorString(vendorString), _productString(productString),
+      _buttonCount(buttonCount), _joystickCount(joystickCount), _triggerCount(triggerCount), _form(NULL)
+{
+}
+
+Gamepad::~Gamepad()
+{
+    if (_form)
+    {
+        SAFE_RELEASE(_form);
+    }
+}
+
+Gamepad* Gamepad::add(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+    unsigned int vendorId, unsigned int productId, char* vendorString, char* productString)
+{
+    Gamepad* gamepad = new Gamepad(id, handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+
+    __gamepads.push_back(gamepad);
+    Game::getInstance()->gamepadEvent(CONNECTED_EVENT, gamepad);
+    return gamepad;
+}
+
+Gamepad* Gamepad::add(const char* formPath)
+{
+    Gamepad* gamepad = new Gamepad(formPath);
+
+    __gamepads.push_back(gamepad);
+    Game::getInstance()->gamepadEvent(CONNECTED_EVENT, gamepad);
+    return gamepad;
+}
+
+void Gamepad::remove(GamepadHandle handle)
+{
+    std::vector<Gamepad*>::iterator it = __gamepads.begin();
+    do
+    {
+        Gamepad* gamepad = *it;
+        if (gamepad->_handle == handle)
+        {
+            Game::getInstance()->gamepadEvent(DISCONNECTED_EVENT, gamepad);
+            it = __gamepads.erase(it);
+        }
+        else
+        {
+        	it++;
+        }
+    } while (it != __gamepads.end());
 }
 
-Gamepad::Gamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount)
-    : _id(id), _handle(handle), _buttonCount(buttonCount), _joystickCount(joystickCount), _triggerCount(triggerCount),
-      _gamepadForm(NULL), _uiJoysticks(NULL), _uiButtons(NULL)
+void Gamepad::remove(Gamepad* gamepad)
 {
+    std::vector<Gamepad*>::iterator it = __gamepads.begin();
+    do
+    {
+        Gamepad* g = *it;
+        if (g == gamepad)
+        {
+            Game::getInstance()->gamepadEvent(DISCONNECTED_EVENT, g);
+            it = __gamepads.erase(it);
+        }
+        else
+        {
+        	it++;
+        }
+    } while (it != __gamepads.end());
 }
 
 void Gamepad::bindGamepadControls(Container* container)
@@ -43,51 +118,84 @@ void Gamepad::bindGamepadControls(Container* container)
         }
         else if (std::strcmp("joystick", control->getType()) == 0)
         {
-            control->addRef();
-            if (!_uiJoysticks)
-                _uiJoysticks = new std::vector<Joystick*>;
-
-            _uiJoysticks->push_back((Joystick*) control);
+            Joystick* joystick = (Joystick*)control;
+            _uiJoysticks[joystick->getIndex()] = joystick;
             _joystickCount++;
         }
         else if (std::strcmp("button", control->getType()) == 0)
         {
-            control->addRef();
-            if (!_uiButtons)
-                _uiButtons = new std::vector<Button*>;
-
-            _uiButtons->push_back((Button*) control);
+            Button* button = (Button*)control;
+            _uiButtons[button->getDataBinding()] = button;
             _buttonCount++;
         }   
     }
 }
 
-Gamepad::~Gamepad()
+Gamepad* Gamepad::getGamepad(GamepadHandle handle)
 {
-    if (_gamepadForm)
+    std::vector<Gamepad*>::const_iterator it;
+    for (it = __gamepads.begin(); it != __gamepads.end(); it++)
     {
-        if (_uiJoysticks)
-        {
-            for (std::vector<Joystick*>::iterator itr = _uiJoysticks->begin(); itr != _uiJoysticks->end(); itr++)
-            {
-                SAFE_RELEASE((*itr));
-            }
-            _uiJoysticks->clear();
-            SAFE_DELETE(_uiJoysticks);
-        }
-
-        if (_uiButtons)
+        Gamepad* gamepad = *it;
+        if (!gamepad->isVirtual() && gamepad->_handle == handle)
         {
-            for (std::vector<Button*>::iterator itr = _uiButtons->begin(); itr!= _uiButtons->end(); itr++)
-            {
-                SAFE_RELEASE((*itr));
-            }
-            _uiButtons->clear();
-            SAFE_DELETE(_uiButtons);
+            return gamepad;
         }
-        
-        SAFE_RELEASE(_gamepadForm);
     }
+
+    return NULL;
+}
+
+std::vector<Gamepad*>* Gamepad::getGamepads()
+{
+    return &__gamepads;
+}
+
+Gamepad::ButtonMapping Gamepad::getButtonMappingFromString(const char* string)
+{
+    if (strcmp(string, "A") == 0 || strcmp(string, "BUTTON_A") == 0)
+        return BUTTON_A;
+    else if (strcmp(string, "B") == 0 || strcmp(string, "BUTTON_B") == 0)
+        return BUTTON_B;
+    else if (strcmp(string, "C") == 0 || strcmp(string, "BUTTON_C") == 0)
+        return BUTTON_C;
+    else if (strcmp(string, "X") == 0 || strcmp(string, "BUTTON_X") == 0)
+        return BUTTON_X;
+    else if (strcmp(string, "Y") == 0 || strcmp(string, "BUTTON_Y") == 0)
+        return BUTTON_Y;
+    else if (strcmp(string, "Z") == 0 || strcmp(string, "BUTTON_Z") == 0)
+        return BUTTON_Z;
+    else if (strcmp(string, "MENU1") == 0 || strcmp(string, "BUTTON_MENU1") == 0)
+        return BUTTON_MENU1;
+    else if (strcmp(string, "MENU2") == 0 || strcmp(string, "BUTTON_MENU2") == 0)
+        return BUTTON_MENU2;
+    else if (strcmp(string, "MENU3") == 0 || strcmp(string, "BUTTON_MENU3") == 0)
+        return BUTTON_MENU3;
+    else if (strcmp(string, "MENU4") == 0 || strcmp(string, "BUTTON_MENU4") == 0)
+        return BUTTON_MENU4;
+    else if (strcmp(string, "L1") == 0 || strcmp(string, "BUTTON_L1") == 0)
+        return BUTTON_L1;
+    else if (strcmp(string, "L2") == 0 || strcmp(string, "BUTTON_L2") == 0)
+        return BUTTON_L2;
+    else if (strcmp(string, "L3") == 0 || strcmp(string, "BUTTON_L3") == 0)
+        return BUTTON_L3;
+    else if (strcmp(string, "R1") == 0 || strcmp(string, "BUTTON_R1") == 0)
+        return BUTTON_R1;
+    else if (strcmp(string, "R2") == 0 || strcmp(string, "BUTTON_R2") == 0)
+        return BUTTON_R2;
+    else if (strcmp(string, "R3") == 0 || strcmp(string, "BUTTON_R3") == 0)
+        return BUTTON_R3;
+    else if (strcmp(string, "UP") == 0 || strcmp(string, "BUTTON_UP") == 0)
+        return BUTTON_UP;
+    else if (strcmp(string, "DOWN") == 0 || strcmp(string, "BUTTON_DOWN") == 0)
+        return BUTTON_DOWN;
+    else if (strcmp(string, "LEFT") == 0 || strcmp(string, "BUTTON_LEFT") == 0)
+        return BUTTON_LEFT;
+    else if (strcmp(string, "RIGHT") == 0 || strcmp(string, "BUTTON_RIGHT") == 0)
+        return BUTTON_RIGHT;
+
+    GP_WARN("Unknown GamepadButton string.");
+    return BUTTON_A;
 }
 
 const char* Gamepad::getId() const
@@ -95,23 +203,43 @@ const char* Gamepad::getId() const
     return _id.c_str();
 }
 
+const unsigned int Gamepad::getVendorId() const
+{
+    return _vendorId;
+}
+
+const unsigned int Gamepad::getProductId() const
+{
+    return _productId;
+}
+
+const char* Gamepad::getVendorString() const
+{
+    return _vendorString.c_str();
+}
+
+const char* Gamepad::getProductString() const
+{
+    return _productString.c_str();
+}
+
 void Gamepad::update(float elapsedTime)
 {
-    if (_gamepadForm && _gamepadForm->isEnabled())
+    if (_form && _form->isEnabled())
     {
-        _gamepadForm->update(elapsedTime);
+        _form->update(elapsedTime);
     }
     else
     {
-        isConnected();
+        Platform::pollGamepadState(this);
     }
 }
 
 void Gamepad::draw()
 {
-    if (_gamepadForm && _gamepadForm->isEnabled())
+    if (_form && _form->isEnabled())
     {
-        _gamepadForm->draw();
+        _form->draw();
     }
 }
 
@@ -120,19 +248,26 @@ unsigned int Gamepad::getButtonCount() const
     return _buttonCount;
 }
 
-Gamepad::ButtonState Gamepad::getButtonState(unsigned int buttonId) const
+bool Gamepad::isButtonDown(ButtonMapping mapping) const
 {
-    GP_ASSERT(buttonId < _buttonCount);
-
-    if (_gamepadForm)
+    if (_form)
     {
-        if (_uiButtons)
-            return _uiButtons->at(buttonId)->getState() == Control::ACTIVE ? BUTTON_PRESSED : BUTTON_RELEASED;
+        Button* button = _uiButtons[mapping];
+        if (button)
+        {
+            return (button->getState() == Control::ACTIVE);
+        }
         else
-            return BUTTON_RELEASED;
+        {
+            return false;
+        }
     }
-    else
-        return Platform::getGamepadButtonState(_handle, buttonId) ? BUTTON_PRESSED : BUTTON_RELEASED;
+    else if (_buttons & (1 << mapping))
+    {
+        return true;
+    }
+
+    return false;
 }
 
 unsigned int Gamepad::getJoystickCount() const
@@ -140,32 +275,16 @@ unsigned int Gamepad::getJoystickCount() const
     return _joystickCount;
 }
 
-bool Gamepad::isJoystickActive(unsigned int joystickId) const
-{
-    GP_ASSERT(joystickId < _joystickCount);
-
-    if (_gamepadForm)
-    {
-        if (_uiJoysticks)
-            return !_uiJoysticks->at(joystickId)->getValue().isZero();
-        else
-            return false;
-    }
-    else
-    {
-        return Platform::isGamepadJoystickActive(_handle, joystickId);
-    }
-}
-
-void Gamepad::getJoystickAxisValues(unsigned int joystickId, Vector2* outValue) const
+void Gamepad::getJoystickValues(unsigned int joystickId, Vector2* outValue) const
 {
     GP_ASSERT(joystickId < _joystickCount);
 
-    if (_gamepadForm)
+    if (_form)
     {
-        if (_uiJoysticks)
+        Joystick* joystick = _uiJoysticks[joystickId];
+        if (joystick)
         {
-            const Vector2& value = _uiJoysticks->at(joystickId)->getValue();
+            const Vector2& value = joystick->getValue();
             outValue->set(value.x, value.y);
         }
         else
@@ -175,40 +294,38 @@ void Gamepad::getJoystickAxisValues(unsigned int joystickId, Vector2* outValue)
     }
     else
     {
-        Platform::getGamepadJoystickAxisValues(_handle, joystickId, outValue);
+        outValue->set(_joysticks[joystickId]);
     }
 }
 
-float Gamepad::getJoystickAxisX(unsigned int joystickId) const
+unsigned int Gamepad::getTriggerCount() const
 {
-    return Platform::getGamepadJoystickAxisX(_handle, joystickId);
+    return _triggerCount;
 }
 
-float Gamepad::getJoystickAxisY(unsigned int joystickId) const
+float Gamepad::getTriggerValue(unsigned int triggerId) const
 {
-    return Platform::getGamepadJoystickAxisY(_handle, joystickId);
+    GP_ASSERT(triggerId < _triggerCount);
+
+    if (_form)
+    {
+        // Triggers are currently not available for virtual gamepads.
+        return 0.0f;
+    }
+    else
+    {
+        return _triggers[triggerId];
+    }
 }
 
 bool Gamepad::isVirtual() const
 {
-    return _gamepadForm;
+    return _form;
 }
 
 Form* Gamepad::getForm() const
 {
-    return _gamepadForm;
-}
-
-bool Gamepad::isConnected() const
-{
-    if (_gamepadForm)
-    {
-        return true;
-    }
-    else
-    {
-        return Platform::isGamepadConnected(_handle);
-    }
+    return _form;
 }
 
 }

+ 129 - 50
gameplay/src/Gamepad.h

@@ -2,12 +2,14 @@
 #define GAMEPAD_H_
 
 #include "Form.h"
-#include "Button.h"
 #include "Joystick.h"
 
 namespace gameplay
 {
 
+class Platform;
+class Button;
+
 /**
  * Defines an interface for handling gamepad input.
  */
@@ -16,6 +18,7 @@ class Gamepad
     friend class Platform;
     friend class Game;
     friend class Control;
+    friend class Button;
 
 public:
 
@@ -29,35 +32,88 @@ public:
     };
 
     /**
-     * Gamepad button states.
+     * Gamepad buttons.
      */
-    enum ButtonState
+    enum ButtonMapping
     {
-        BUTTON_PRESSED = gameplay::Control::Listener::PRESS, 
-        BUTTON_RELEASED = gameplay::Control::Listener::RELEASE
+        BUTTON_A,
+        BUTTON_B,
+        BUTTON_C,
+        BUTTON_X,
+        BUTTON_Y,
+        BUTTON_Z,
+        BUTTON_MENU1,
+        BUTTON_MENU2,
+        BUTTON_MENU3,
+        BUTTON_MENU4,
+        BUTTON_L1,
+        BUTTON_L2,
+        BUTTON_L3,
+        BUTTON_R1,
+        BUTTON_R2,
+        BUTTON_R3,
+        BUTTON_UP,
+        BUTTON_DOWN,
+        BUTTON_LEFT,
+        BUTTON_RIGHT
     };
 
     /**
-     * Gets the Gamepad's ID.
+     * Get all connected gamepads.
+     *
+     * @return A vector of all connected gamepads.
+     */
+    static std::vector<Gamepad*>* getGamepads();
+
+    /**
+     * Get this gamepad's ID as a string.
      *
-     * @return the Gamepad's ID.
+     * @return This gamepad's ID as a string.
      */
     const char* getId() const;
 
     /**
-     * Gets the number of button on the gamepad.
+     * Get this gamepad's vendor ID.
+     *
+     * @return This gamepad's vendor ID.
+     */
+    const unsigned int getVendorId() const;
+
+    /**
+     * Get this gamepad's product ID.
      *
-     * @return the number of buttons on the gamepad.
+     * @return This gamepad's product ID.
+     */
+    const unsigned int getProductId() const;
+
+    /**
+     * Get this gamepad's vendor name.
+     *
+     * @return This gamepad's vendor name.
+     */
+    const char* getVendorString() const;
+
+    /**
+     * Get this gamepad's product name.
+     *
+     * @return This gamepad's product name.
+     */
+    const char* getProductString() const;
+
+    /**
+     * Gets the number of buttons on this gamepad.
+     *
+     * @return The number of buttons on this gamepad.
      */
     unsigned int getButtonCount() const;
 
     /** 
-     * Gets the current state of the specified button.
+     * Gets whether the given button is currently pressed down.
      *
-     * @param buttonId The index of the button on the gamepad to get the state for.
-     * @return whether the button is currently pressed or not.
+     * @param button The enum of the button on the gamepad to get the state for.
+     * @return Whether the button is currently pressed or not.
      */
-    ButtonState getButtonState(unsigned int buttonId) const;
+    bool isButtonDown(ButtonMapping button) const;
     
     /**
      * Gets the number of joysticks on the gamepad.
@@ -66,57 +122,54 @@ public:
      */
     unsigned int getJoystickCount() const;
 
-    /**
-     * Gets whether the specified joystick's state is active or not.
-     * 
-     * @param joystickId The index of the joystick on the gamepad to get state for.
-     * @return Whether the given joystick is active or not.
-     */
-    bool isJoystickActive(unsigned int joystickId) const;
-
     /**
      * Returns the specified joystick's value as a Vector2.
      *
      * @param joystickId The index of the joystick to get the value for.
-     * @param outValues The current x-axis and y-asix value displacement of the joystick.
+     * @param outValues The current x-axis and y-axis values of the joystick.
      */
-    void getJoystickAxisValues(unsigned int joystickId, Vector2* outValues) const;
+    void getJoystickValues(unsigned int joystickId, Vector2* outValues) const;
 
     /**
-     * Returns the specified joystick's x-axis value.
+     * Returns the number of analog triggers (as opposed to digital shoulder buttons)
+     * on this gamepad.
      *
-     * @param joystickId The index of the joystick to get the x-axis value for.
-     * @return The current value of the joystick's x-axis value.
+     * @return The number of analog triggers on this gamepad.
      */
-    float getJoystickAxisX(unsigned int joystickId) const;
-    
+    unsigned int getTriggerCount() const;
+
     /**
-     * Returns the specified joystick's y-axis value.
-     * 
-     * @param joystickId The index of the joystick to get the y-axis value for.
-     * @return The current value of the joystick's y-axis value.
+     * Returns the value of an analog trigger on this gamepad.  This value will be a
+     * number between 0 and 1, where 0 means the trigger is in its resting (unpressed)
+     * state and 1 means the trigger has been completely pressed down.
+     *
+     * @param triggerId The trigger to query.
+     * @return The value of the given trigger.
      */
-    float getJoystickAxisY(unsigned int joystickId) const;
+    float getTriggerValue(unsigned int triggerId) const;
 
     /**
      * Returns whether the gamepad is currently represented with a UI form or not.
      *
      * @return true if the gamepad is currently represented by a UI form; false if the gamepad is
-     *      not represented by a UI form
+     *         not represented by a UI form.
      */
     bool isVirtual() const;
 
     /**
      * Gets the Form used to represent this gamepad.
      *
-     * Note: What if the user decides to add gamepad controls (joysticks, buttons) to the gamepad form? How do we handle new/deleted controls?
-     *
      * @return the Form used to represent this gamepad. NULL if the gamepad is not represented with a Form.
      */
     Form* getForm() const;
 
     /**
-     * Updates the gamepad.
+     * Updates the gamepad's state.  For a virtual gamepad, this results in calling update()
+     * on the gamepad's form.  For physical gamepads, this polls the gamepad's state
+     * at the platform level.  Either way, this should be called once a frame before
+     * getting and using a gamepad's current state.
+     *
+     * @param elapsedTime The elapsed game time.
      */
     void update(float elapsedTime);
 
@@ -130,10 +183,9 @@ private:
     /**
      * Constructs a gamepad from the specified .form file.
      *
-     * @param handle The gamepad handle
      * @param formPath The path the the .form file.
      */ 
-    Gamepad(unsigned int handle, const char* formPath);
+    Gamepad(const char* formPath);
 
     /**
      * Constructs a physical gamepad.
@@ -144,13 +196,33 @@ private:
      * @param joystickCount the number of joysticks on the gamepad.
      * @param triggerCount the number of triggers on the gamepad.
      */
-    Gamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount);
+    Gamepad(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+            unsigned int vendorId, unsigned int productId, char* vendorString, char* productString);
 
     /**
      * Copy constructor.
      */
     Gamepad(const Gamepad& copy);
 
+    /**
+     * Used by platforms to add gamepads to the set available to games.
+     */
+    static Gamepad* add(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                        unsigned int vendorId, unsigned int productId, char* vendorString, char* productString);
+
+    /**
+     * Used by Game::loadGamepads() to add virtual gamepads from a game's config file.
+     */
+    static Gamepad* add(const char* formPath);
+
+    static void remove(GamepadHandle handle);
+
+    static void remove(Gamepad* gamepad);
+
+    static Gamepad* getGamepad(GamepadHandle handle);
+
+    static ButtonMapping getButtonMappingFromString(const char* string);
+
     /** 
      * Destructor.
      */
@@ -161,21 +233,28 @@ private:
      */
     void bindGamepadControls(Container* container);
 
-    /**
-     * Gets whether the Gamepad is currently connected to the Platform.
-     */
-    bool isConnected() const;
-        
-    std::string _id;              // ID of the Gamepad
-    unsigned int _handle;         // The handle of the Gamepad.
+    static unsigned int getIndexFromMapping(Gamepad::ButtonMapping mapping);
+
+    std::string _id;
+    GamepadHandle _handle;        // The handle of the Gamepad.
+    unsigned int _vendorId;
+    unsigned int _productId;
+    std::string _vendorString;
+    std::string _productString;
+
     unsigned int _buttonCount;    // Number of buttons.
     unsigned int _joystickCount;  // Number of joysticks.
     unsigned int _triggerCount;   // Number of triggers.
     
     // Data needed for virtual gamepads.
-    Form* _gamepadForm;
-    std::vector<Joystick*>* _uiJoysticks;
-    std::vector<Button*>* _uiButtons;
+    Form* _form;
+    Joystick* _uiJoysticks[2];
+    Button* _uiButtons[20];
+
+    // Current gamepad state.
+    unsigned int _buttons;
+    Vector2 _joysticks[2];
+    float _triggers[2];
 };
 
 }

+ 1 - 0
gameplay/src/Joystick.cpp

@@ -32,6 +32,7 @@ Joystick* Joystick::create(Theme::Style* style, Properties* properties)
 {
     Joystick* joystick = new Joystick();
     joystick->initialize(style, properties);
+    joystick->_index = properties->getInt("index");
     return joystick;
 }
 

+ 3 - 0
gameplay/src/Joystick.h

@@ -113,6 +113,8 @@ public:
      */
     const char* getType() const;
 
+    inline const unsigned int getIndex() const;
+
 protected:
     
     /**
@@ -176,6 +178,7 @@ private:
     Vector2 _displacement;
     Vector2* _innerSize;
     Vector2* _outerSize;
+    unsigned int _index;
 };
 
 }

+ 5 - 0
gameplay/src/Joystick.inl

@@ -46,4 +46,9 @@ inline bool Joystick::isRelative() const
     return _relative;
 }
 
+inline const unsigned int Joystick::getIndex() const
+{
+    return _index;
+}
+
 }

+ 1 - 0
gameplay/src/Layout.cpp

@@ -12,6 +12,7 @@ void Layout::align(Control* control, const Container* container)
     GP_ASSERT(container);
 
     if (control->_alignment != Control::ALIGN_TOP_LEFT ||
+        control->_isAlignmentSet ||
         control->_autoWidth || control->_autoHeight)
     {
         Rectangle controlBounds = control->getBounds();

+ 72 - 3
gameplay/src/Matrix.cpp

@@ -1,5 +1,6 @@
 #include "Base.h"
 #include "Matrix.h"
+#include "Plane.h"
 #include "Quaternion.h"
 #include "MathUtil.h"
 
@@ -19,7 +20,8 @@ Matrix::Matrix()
     *this = Matrix::identity();
 }
 
-Matrix::Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+Matrix::Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
+               float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
 {
     set(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
 }
@@ -60,7 +62,8 @@ const Matrix& Matrix::zero()
 
 void Matrix::createLookAt(const Vector3& eyePosition, const Vector3& targetPosition, const Vector3& up, Matrix* dst)
 {
-    createLookAt(eyePosition.x, eyePosition.y, eyePosition.z, targetPosition.x, targetPosition.y, targetPosition.z, up.x, up.y, up.z, dst);
+    createLookAt(eyePosition.x, eyePosition.y, eyePosition.z, targetPosition.x, targetPosition.y, targetPosition.z,
+                 up.x, up.y, up.z, dst);
 }
 
 void Matrix::createLookAt(float eyePositionX, float eyePositionY, float eyePositionZ,
@@ -162,6 +165,71 @@ void Matrix::createOrthographicOffCenter(float left, float right, float bottom,
     dst->m[14] = (-(zFarPlane + zNearPlane)) * f_n;
     dst->m[15] = 1.0f;
 }
+    
+void Matrix::createBillboard(const Vector3& objectPosition, const Vector3& cameraPosition,
+                             const Vector3& cameraUpVector, Matrix* dst)
+{
+    createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, NULL, dst);
+}
+
+void Matrix::createBillboard(const Vector3& objectPosition, const Vector3& cameraPosition,
+                             const Vector3& cameraUpVector, const Vector3& cameraForwardVector,
+                             Matrix* dst)
+{
+    createBillboardHelper(objectPosition, cameraPosition, cameraUpVector, &cameraForwardVector, dst);
+}
+
+void Matrix::createBillboardHelper(const Vector3& objectPosition, const Vector3& cameraPosition,
+                                   const Vector3& cameraUpVector, const Vector3* cameraForwardVector,
+                                   Matrix* dst)
+{
+    Vector3 delta(objectPosition, cameraPosition);
+    bool isSufficientDelta = delta.lengthSquared() > MATH_EPSILON;
+
+    dst->setIdentity();
+    dst->m[3] = objectPosition.x;
+    dst->m[7] = objectPosition.y;
+    dst->m[11] = objectPosition.z;
+
+    // As per the contracts for the 2 variants of createBillboard, we need
+    // either a safe default or a sufficient distance between object and camera.
+    if (cameraForwardVector || isSufficientDelta)
+    {
+        Vector3 target = isSufficientDelta ? cameraPosition : (objectPosition - *cameraForwardVector);
+
+        // A billboard is the inverse of a lookAt rotation
+        Matrix lookAt;
+        createLookAt(objectPosition, target, cameraUpVector, &lookAt);
+        dst->m[0] = lookAt.m[0];
+        dst->m[1] = lookAt.m[4];
+        dst->m[2] = lookAt.m[8];
+        dst->m[4] = lookAt.m[1];
+        dst->m[5] = lookAt.m[5];
+        dst->m[6] = lookAt.m[9];
+        dst->m[8] = lookAt.m[2];
+        dst->m[9] = lookAt.m[6];
+        dst->m[10] = lookAt.m[10];
+    }
+}
+    
+void Matrix::createReflection(const Plane& plane, Matrix* dst)
+{
+    Vector3 normal(plane.getNormal());
+    float k = -2.0f * plane.getDistance();
+
+    dst->setIdentity();
+
+    dst->m[0] -= 2.0f * normal.x * normal.x;
+    dst->m[5] -= 2.0f * normal.y * normal.y;
+    dst->m[10] -= 2.0f * normal.z * normal.z;
+    dst->m[1] = dst->m[4] = -2.0f * normal.x * normal.y;
+    dst->m[2] = dst->m[8] = -2.0f * normal.x * normal.z;
+    dst->m[6] = dst->m[9] = -2.0f * normal.y * normal.z;
+    
+    dst->m[3] = k * normal.x;
+    dst->m[7] = k * normal.y;
+    dst->m[11] = k * normal.z;
+}
 
 void Matrix::createScale(const Vector3& scale, Matrix* dst)
 {
@@ -763,7 +831,8 @@ void Matrix::scale(const Vector3& s, Matrix* dst) const
     scale(s.x, s.y, s.z, dst);
 }
 
-void Matrix::set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+void Matrix::set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
+                 float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
 {
     m[0]  = m11;
     m[1]  = m21;

+ 63 - 31
gameplay/src/Matrix.h

@@ -7,6 +7,8 @@
 namespace gameplay
 {
 
+class Plane;
+
 /**
  * Defines a 4 x 4 floating point matrix representing a 3D transformation.
  *
@@ -77,8 +79,8 @@ public:
      * @param m43 The third element of the fourth row.
      * @param m44 The fourth element of the fourth row.
      */
-    Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31,
-           float m32, float m33, float m34, float m41, float m42, float m43, float m44);
+    Matrix(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
+           float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44);
 
     /**
      * Creates a matrix initialized to the specified column-major array.
@@ -149,8 +151,9 @@ public:
      * @param upZ The up vector z-coordinate value.
      * @param dst A matrix to store the result in.
      */
-    static void createLookAt(float eyePositionX, float eyePositionY, float eyePositionZ, float targetCenterX,
-                             float targetCenterY, float targetCenterZ, float upX, float upY, float upZ, Matrix* dst);
+    static void createLookAt(float eyePositionX, float eyePositionY, float eyePositionZ,
+                             float targetCenterX, float targetCenterY, float targetCenterZ,
+                             float upX, float upY, float upZ, Matrix* dst);
 
     /**
      * Builds a perspective projection matrix based on a field of view and returns by value.
@@ -207,31 +210,54 @@ public:
      * @param zFarPlane The maximum z-value of the view volume.
      * @param dst A matrix to store the result in.
      */
-    static void createOrthographicOffCenter(float left, float right, float bottom, float top, float zNearPlane,
-                                            float zFarPlane, Matrix* dst);
-
-//    /*
-//     * Creates a spherical billboard that rotates around a specified object position.
-//     *
-//     * This method computes the facing direction of the billboard from the object position
-//     * and camera position. When the object and camera positions are too close, the matrix
-//     * will not be accurate. To avoid this problem, the method uses the optional camera
-//     * forward vector if the positions are too close.
-//     *
-//     * @param objectPosition The position of the object the billboard will rotate around.
-//     * @param cameraPosition The position of the camera.
-//     * @param cameraUpVector The up vector of the camera.
-//     * @param dst A matrix to store the result in.
-//     */
-//    static void createBillboard(const Vector3& objectPosition, const Vector3& cameraPosition, const Vector3& cameraUpVector, Matrix* dst);
-//
-//    /*
-//     * Fills in an existing Matrix so that it reflects the coordinate system about a specified Plane.
-//     *
-//     * @param plane The Plane about which to create a reflection.
-//     * @param dst A matrix to store the result in.
-//     */
-//    static void createReflection(const Plane& plane, Matrix* dst);
+    static void createOrthographicOffCenter(float left, float right, float bottom, float top,
+                                            float zNearPlane, float zFarPlane, Matrix* dst);
+
+    /*
+     * Creates a spherical billboard that rotates around a specified object position.
+     *
+     * This method computes the facing direction of the billboard from the object position
+     * and camera position. When the object and camera positions are too close, the matrix
+     * will not be accurate. To avoid this problem, this method defaults to the identity
+     * rotation if the positions are too close. (See the other overload of createBillboard
+     * for an alternative approach).
+     *
+     * @param objectPosition The position of the object the billboard will rotate around.
+     * @param cameraPosition The position of the camera.
+     * @param cameraUpVector The up vector of the camera.
+     * @param dst A matrix to store the result in.
+     */
+    static void createBillboard(const Vector3& objectPosition, const Vector3& cameraPosition,
+                                const Vector3& cameraUpVector, Matrix* dst);
+
+    /*
+     * Creates a spherical billboard that rotates around a specified object position with
+     * provision for a safe default orientation.
+     *
+     * This method computes the facing direction of the billboard from the object position
+     * and camera position. When the object and camera positions are too close, the matrix
+     * will not be accurate. To avoid this problem, this method uses the specified camera
+     * forward vector if the positions are too close. (See the other overload of createBillboard
+     * for an alternative approach).
+     *
+     * @param objectPosition The position of the object the billboard will rotate around.
+     * @param cameraPosition The position of the camera.
+     * @param cameraUpVector The up vector of the camera.
+     * @param cameraForwardVector The forward vector of the camera, used if the positions
+     *                            are too close.
+     * @param dst A matrix to store the result in.
+     */
+    static void createBillboard(const Vector3& objectPosition, const Vector3& cameraPosition,
+                                const Vector3& cameraUpVector, const Vector3& cameraForwardVector,
+                                Matrix* dst);
+
+    /*
+     * Fills in an existing Matrix so that it reflects the coordinate system about a specified Plane.
+     *
+     * @param plane The Plane about which to create a reflection.
+     * @param dst A matrix to store the result in.
+     */
+    static void createReflection(const Plane& plane, Matrix* dst);
 
     /**
      * Creates a scale matrix.
@@ -664,8 +690,8 @@ public:
      * @param m43 The third element of the fourth row.
      * @param m44 The fourth element of the fourth row.
      */
-    void set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31,
-             float m32, float m33, float m34, float m41, float m42, float m43, float m44);
+    void set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24,
+             float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44);
 
     /**
      * Sets the values of this matrix to those in the specified column-major array.
@@ -885,6 +911,12 @@ public:
      * @return This matrix, after the multiplication occurs.
      */
     inline Matrix& operator*=(const Matrix& m);
+    
+private:
+
+    static void createBillboardHelper(const Vector3& objectPosition, const Vector3& cameraPosition,
+                                      const Vector3& cameraUpVector, const Vector3* cameraForwardVector,
+                                      Matrix* dst);
 };
 
 /**

+ 12 - 0
gameplay/src/Node.cpp

@@ -337,6 +337,18 @@ unsigned int Node::findNodes(const char* id, std::vector<Node*>& nodes, bool rec
     
     unsigned int count = 0;
 
+    // If the node has a model with a mesh skin, search the skin's hierarchy as well.
+    Node* rootNode = NULL;
+    if (_model != NULL && _model->getSkin() != NULL && (rootNode = _model->getSkin()->_rootNode) != NULL)
+    {
+        if ((exactMatch && rootNode->_id == id) || (!exactMatch && rootNode->_id.find(id) == 0))
+        {
+            nodes.push_back(rootNode);
+            ++count;
+        }
+        count += rootNode->findNodes(id, nodes, true, exactMatch);
+    }
+
     // Search immediate children first.
     for (Node* child = getFirstChild(); child != NULL; child = child->getNextSibling())
     {

+ 5 - 5
gameplay/src/Node.h

@@ -334,7 +334,7 @@ public:
     /**
      * Returns the forward vector of the Node in view space.
      *
-     * @return The forwward vector in view space.
+     * @return The forward vector in view space.
      */
     Vector3 getForwardVectorView() const;
 
@@ -505,11 +505,11 @@ public:
      * entities in a game that still require collision events, such as volumetric triggers, 
      * power-ups, etc.
      *
-     * Characters are an extention of ghost objects which provide a number of additional features
+     * Characters are an extension of ghost objects which provide a number of additional features
      * for animating and moving characters within a game. Characters are represented as ghost
      * objects instead of rigid bodies to allow more direct control over character movement,
      * since attempting to model a physics character with a simulated rigid body usually results
-     * in unresponse and unpredictable character movement. Unlike normal ghost objects,
+     * in unresponsive and unpredictable character movement. Unlike normal ghost objects,
      * characters to react to other characters and rigid bodies in the world. Characters react
      * to gravity and collide (and respond) with rigid bodies to allow them to walk on the ground,
      * slide along walls and walk up/down slopes and stairs.
@@ -517,12 +517,12 @@ public:
      * @param type The type of the collision object to set; to disable the physics
      *        collision object, pass PhysicsCollisionObject::NONE.
      * @param shape Definition of a physics collision shape to be used for this collision object.
-     *        Use the static shape methods on the PhysicsCollisionShape class to specificy a shape
+     *        Use the static shape methods on the PhysicsCollisionShape class to specify a shape
      *        definition, such as PhysicsCollisionShape::box().
      * @param rigidBodyParameters If type is PhysicsCollisionObject::RIGID_BODY or
      *        PhysicsCollisionObject::VEHICLE, this must point to a valid rigid body
      *        parameters object containing information about the rigid body;
-     *        otherwise, this parmater may be NULL.
+     *        otherwise, this parameter may be NULL.
      */
     PhysicsCollisionObject* setCollisionObject(PhysicsCollisionObject::Type type, const PhysicsCollisionShape::Definition& shape = PhysicsCollisionShape::box(), 
                                                PhysicsRigidBody::Parameters* rigidBodyParameters = NULL);

+ 7 - 3
gameplay/src/PhysicsCharacter.cpp

@@ -625,7 +625,9 @@ bool PhysicsCharacter::fixCollision(btCollisionWorld* world)
     }
 
     // Set the new world transformation to apply to fix the collision.
-    _node->translate(Vector3(currentPosition.x(), currentPosition.y(), currentPosition.z()) - startPosition);
+    Vector3 newPosition = Vector3(currentPosition.x(), currentPosition.y(), currentPosition.z()) - startPosition;
+    if (newPosition != Vector3::zero())
+        _node->translate(newPosition);
 
     return collision;
 }
@@ -687,8 +689,10 @@ void PhysicsCharacter::updateAction(btCollisionWorld* collisionWorld, btScalar d
         stepDown(collisionWorld, deltaTimeStep);
 
     // Set new position.
-    btVector3 translation = _currentPosition - startPosition;
-    _node->translate(translation.x(), translation.y(), translation.z());
+    btVector3 newPosition = _currentPosition - startPosition;
+    Vector3 translation = Vector3(newPosition.x(), newPosition.y(), newPosition.z());
+    if (translation !=  Vector3::zero())
+        _node->translate(translation);
 }
 
 

+ 1 - 1
gameplay/src/PhysicsCollisionObject.h

@@ -182,7 +182,7 @@ public:
     bool isDynamic() const;
 
     /**
-     * Check if th collision object is enabled.
+     * Check if the collision object is enabled.
      *
      * @return true if the collision object is enabled.
      */

+ 1 - 100
gameplay/src/Platform.h

@@ -221,107 +221,8 @@ public:
      * @param evt The gesture event to register to start recognizing events for.
      */
     static bool isGestureRegistered(Gesture::GestureEvent evt);
-    
-    /** 
-     * Gets the number of gamepad devices connected to the Platform.
-     *
-     * Note: Calling this method also checks if any gamepads have been attached to or detached from the Platform 
-     *
-     * @return the number of gamepads connected to the Platform.
-     */
-    static unsigned int getGamepadsConnected();
-
-    /**
-     * Gets whether the specified gamepad is connected to the Platform.
-     *
-     * @param gamepadHandle the handle to the gamepad.
-     */
-    static bool isGamepadConnected(unsigned int gamepadHandle);
-
-    /**
-     * Gets the specified gamepad's ID.
-     *
-     * @param gamepadHandle the handle to the gamepad.
-     * @return the ID of the specified gamepad.
-     */
-    static const char* getGamepadId(unsigned int gamepadHandle);
 
-    /**
-     * Gets the number of buttons on the specified gamepad.
-     * 
-     * @param gamepadHandle handle to the gamepad to get the number of buttons for.
-     * @return the number of buttons on the gamepad.
-     */
-    static unsigned int getGamepadButtonCount(unsigned int gamepadHandle);
-
-    /**
-     * Gets the button state for the specified gamepad and button index.
-     *
-     * @param gamepadHandle handle to the gamepad to query the button state for.
-     * @param buttonIndex the index to the button to retrieve the state for.
-     */
-    static bool getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex);
-
-    /**
-     * Gets the number of joysticks on the specified gamepad.
-     * 
-     * @param gamepadHandle handle to the gamepad to get the number of joysticks for.
-     * @return the number of joysticks supported on the gamepad.
-     */
-    static unsigned int getGamepadJoystickCount(unsigned int gamepadHandle);
-
-    /** 
-     * Returns whether the joystick on the specified gamepad is active.
-     *
-     * @param gamepadHandle The handle to the gamepad.
-     * @param joystickIndex The index of the joystick.
-     * @return true if the joystick is active; false if the joystick is inactive.
-     */
-    static bool isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex);
-
-    /**
-     * Gets the value of the joystick's x-axis on the specified joystick.
-     *
-     * @param gamepadHandle The handle to the gamepad.
-     * @param joystickIndex The index of the joystick.
-     * @return the value of the joystick's x-axis.
-     */
-    static float getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex);
-
-    /**
-     * Gets the value of the joystick's x-axis on the specified joystick.
-     *
-     * @param gamepadHandle The handle to the gamepad.
-     * @param joystickIndex The index of the joystick.
-     * @return the value of the joystick's x-axis.
-     */
-    static float getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex);
-
-    /**
-     * Gets the values for the specified gamepad and joystick index.
-     *
-     * @param gamepadHandle handle to the gamepad to query the joystick value for.
-     * @param joystickIndex the index to the joystick to retrieve the value for.
-     * @param outValue will be populated with the current value of the specified joystick.
-     */
-    static void getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValue);
-
-    /**
-     * Gets the number of triggers on the specified gamepad.
-     *
-     * @param gamepadHandle handle to the gamepad to get the number of triggers for.
-     * @return the number of triggers supported on the gamepad.
-     */ 
-    static unsigned int getGamepadTriggerCount(unsigned int gamepadHandle);
-
-    /**
-     * Gets the value for the specified gamepad and trigger index.
-     *
-     * @param gamepadHandle handle to the gamepad to query the trigger value for.
-     * @param triggerIndex the index to the trigger to retrieve the value for.
-     * @return the value of the specified trigger.
-     */
-    static float getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex);
+    static void pollGamepadState(Gamepad* gamepad);
 
     /**
      * Touch callback on touch events. This method handles passing the touch event to the form or to the game.

+ 1 - 56
gameplay/src/PlatformAndroid.cpp

@@ -1299,63 +1299,8 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
     return __gestureEventsProcessed.test(evt);
 }
 
-unsigned int Platform::getGamepadsConnected()
+void Platform::pollGamepadState(Gamepad* gamepad)
 {
-    return 0;
-}
-
-bool Platform::isGamepadConnected(unsigned int gamepadHandle)
-{
-    return false;
-}
-
-const char* Platform::getGamepadId(unsigned int gamepadHandle)
-{
-    return NULL;
-}
-
-unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
-{
-    return false;
-}
-
-unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return false;
-}
-
-float Platform::getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-float Platform::getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-void Platform::getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValue)
-{
-}
-
-unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
-{
-    return 0.0f;
 }
 
 bool Platform::launchURL(const char *url)

+ 207 - 59
gameplay/src/PlatformBlackBerry.cpp

@@ -491,6 +491,149 @@ void gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* para
     }
 }
 
+#ifdef __BB10__
+
+static const int __VIDs[] = {
+    0x1038,
+    0x057e,
+    0x25b6
+};
+
+static const int __PIDs[] = {
+    0x1412,
+    0x0306,
+    0x0001
+};
+
+static const char* __vendorStrings[] =
+{
+    "SteelSeries",
+    "Nintendo",
+    "Fructel"
+};
+
+static const char* __productStrings[] =
+{
+    "FREE",
+    "Wii Remote",
+    "Gametel"
+};
+
+static const unsigned int __knownGamepads = 3;
+
+void loadGamepad(GamepadHandle handle, int* buttonCount, int* joystickCount, int* productId, int* vendorId, char* id, char* productString, char* vendorString)
+{
+    screen_get_device_property_iv(handle, SCREEN_PROPERTY_BUTTON_COUNT, buttonCount);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_ID_STRING, 128, id);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_PRODUCT, 64, productString);
+    screen_get_device_property_cv(handle, SCREEN_PROPERTY_VENDOR, 64, vendorString);
+
+    // Check for the existence of analog sticks.
+    int analogs[3];
+    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG0, analogs))
+    {
+    	++(*joystickCount);
+    }
+
+    if (!screen_get_device_property_iv(handle, SCREEN_PROPERTY_ANALOG1, analogs))
+    {
+    	++(*joystickCount);
+    }
+
+    // ID string format: A-BBBB-CCCC-D.D
+    // A is the device's index
+    // BBBB is the device's Vendor ID (in hexadecimal)
+    // CCCC is the device's Product ID (also in hexadecimal)
+    // D.D is the device's version number
+    char* token = strtok(id, "-");
+    token = strtok(NULL, "-");
+    if (token)
+    {
+	    *vendorId = strtol(token, NULL, 16);
+    }
+
+    token = strtok(NULL, "-");
+    if (token)
+    {
+        *productId = strtol(token, NULL, 16);
+    }
+
+    // For gamepads unknown to BB10,
+    // check VID and PID against gamepads known to gameplay.
+    if (strlen(productString) == 0 || strlen(vendorString) == 0)
+    {
+        for (unsigned int i = 0; i < __knownGamepads; ++i)
+        {
+            if (__VIDs[i] == *vendorId && __PIDs[i] == *productId)
+            {
+            	strcpy(vendorString, __vendorStrings[i]);
+                strcpy(productString, __productStrings[i]);
+            }
+        }
+    }
+}
+
+void Platform::pollGamepadState(Gamepad* gamepad)
+{
+    screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_BUTTONS, (int*)&gamepad->_buttons);
+
+    unsigned int i;
+    for (i = 0; i < gamepad->_joystickCount; ++i)
+    {
+        GP_ASSERT(i < 2);
+
+        int analog[3];
+        switch (i)
+        {
+        case 0:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
+            break;
+        case 1:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
+            break;
+        }
+        
+        // So far we've tested two gamepads with analog sticks on BlackBerry:
+        // the SteelSeries FREE, and the iControlPad.
+        // Both return values between -128 and +127, with the y axis starting from
+        // the top at -128.
+        // 1 / 128 == 0.0078125f
+        // 1 / 127 == 0.0078740157480315f
+        //float x = (float)analog[0] * 0.0078125f;
+        //float y = -(float)analog[1] * 0.0078125f;
+        float x = (float)analog[0];
+        float y = -(float)analog[1];
+        x *= (x < 0) ? 0.0078125f : 0.0078740157480315f;
+        y *= (y > 0) ? 0.0078125f : 0.0078740157480315f;
+
+        gamepad->_joysticks[i].set(x, y);        
+    }
+
+    for (i = 0; i < gamepad->_triggerCount; ++i)
+    {
+        GP_ASSERT(i < 2);
+
+        int analog[3];
+        switch (i)
+        {
+        case 0:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG0, analog);
+            break;
+        case 1:
+            screen_get_device_property_iv(gamepad->_handle, SCREEN_PROPERTY_ANALOG1, analog);
+            break;
+        }
+
+        float value = (float)analog[2] * 0.0078125f;
+        gamepad->_triggers[i] = value;
+    }
+}
+#else
+void Platform::getGamepadButtonValues(GamepadHandle handle, unsigned int* out) { }
+void Platform::getGamepadJoystickValues(GamepadHandle handle, unsigned int joystickIndex, Vector2* outValue) { }
+void Platform::getGamepadTriggerValue(GamepadHandle handle, unsigned int triggerIndex, float* out) { }
+#endif
+
 Platform::Platform(Game* game)
     : _game(game)
 {
@@ -545,6 +688,8 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     FileSystem::setResourcePath("./app/native/");
     Platform* platform = new Platform(game);
 
+    screen_device_t* screenDevs;
+
     // Query game config
     int samples = 0;
     Properties* config = Game::getInstance()->getConfig()->getNamespace("window", true);
@@ -832,6 +977,31 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES");
     }
 
+    // Discover gamepad devices.
+    int count;
+    screen_get_context_property_iv(__screenContext, SCREEN_PROPERTY_DEVICE_COUNT, &count);
+    screenDevs = (screen_device_t*)calloc(count, sizeof(screen_device_t));
+    screen_get_context_property_pv(__screenContext, SCREEN_PROPERTY_DEVICES, (void**)screenDevs);
+
+	for (int i = 0; i < count; i++) {
+	    int type;
+        screen_get_device_property_iv(screenDevs[i], SCREEN_PROPERTY_TYPE, &type);
+
+        if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
+        {
+            int buttonCount = 0;
+            int joystickCount = 0;
+            int productId;
+            int vendorId;
+            char id[128];
+            char productString[64];
+            char vendorString[64];
+            loadGamepad(screenDevs[i], &buttonCount, &joystickCount, &productId, &vendorId, id, productString, vendorString);
+            Gamepad::add(id, screenDevs[i], buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+        }
+	}
+	free(screenDevs);
+
     return platform;
 
 error:
@@ -1055,6 +1225,43 @@ int Platform::enterMessagePump()
                         }
                         break;
                     }
+#ifdef __BB10__
+                    case SCREEN_EVENT_DEVICE:
+                    {
+                        // A device was attached or removed.
+                        screen_device_t device;
+                        int attached;
+
+                        screen_get_event_property_pv(__screenEvent, SCREEN_PROPERTY_DEVICE, (void**)&device);
+                        screen_get_event_property_iv(__screenEvent, SCREEN_PROPERTY_ATTACHED, &attached);
+
+                        if (attached)
+                        {
+                            int type;
+                            screen_get_device_property_iv(device, SCREEN_PROPERTY_TYPE, &type);
+                            if (type == SCREEN_EVENT_GAMEPAD || type == SCREEN_EVENT_JOYSTICK)
+                            {
+                                int buttonCount = 0;
+                                int joystickCount = 0;
+                                int productId;
+                                int vendorId;
+                                char id[128];
+                                char productString[64];
+                                char vendorString[64];
+                                loadGamepad(device, &buttonCount, &joystickCount, &productId, &vendorId, id, productString, vendorString);
+                                Gamepad::add(id, device, buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+                            }
+                        }
+                        else
+                        {
+                            Gamepad::remove(device);
+                        }
+
+                        break;
+                    }
+#endif
+                    default:
+                        break;
                 }
             }
             else if (domain == navigator_get_domain())
@@ -1365,65 +1572,6 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
     return __gestureEventsProcessed.test(evt);
 }
 
-unsigned int Platform::getGamepadsConnected()
-{
-    return 0;
-}
-
-bool Platform::isGamepadConnected(unsigned int gamepadHandle)
-{
-    return false;
-}
-
-const char* Platform::getGamepadId(unsigned int gamepadHandle)
-{
-    return NULL;
-}
-
-unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
-{
-    return false;
-}
-
-unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return false;
-}
-
-float Platform::getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-float Platform::getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-void Platform::getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValues)
-{
-}
-
-unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
-{
-    return 0.0f;
-}
-
 bool Platform::launchURL(const char* url)
 {
     if (url == NULL || *url == '\0')

+ 126 - 75
gameplay/src/PlatformLinux.cpp

@@ -24,6 +24,9 @@ static double __timeAbsolute;
 static bool __vsync = WINDOW_VSYNC;
 static float __pitch;
 static float __roll;
+static bool __mouseCaptured = false;
+static float __mouseCapturePointX = 0;
+static float __mouseCapturePointY = 0;
 static bool __cursorVisible = true;
 static Display* __display;
 static Window   __window;
@@ -499,10 +502,16 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     __attachToWindow = (Window)attachToWindow;
     FileSystem::setResourcePath("./");
     Platform* platform = new Platform(game);
-
-    // Get window configuration
-
-    // Default values
+    
+    // Get the display and initialize
+    __display = XOpenDisplay(NULL);
+    if (__display == NULL)
+    {
+        perror("XOpenDisplay");
+        return NULL;
+    }
+     
+    // Get the window configuration values
     const char *title = NULL;
     int __x = 0, __y = 0, __width = 1280, __height = 800;
     bool fullscreen = false;
@@ -516,35 +525,29 @@ Platform* Platform::create(Game* game, void* attachToWindow)
 
             // Read window rect.
             int x = config->getInt("x");
-            if (x != 0) __x = x;
-
             int y = config->getInt("y");
-            if (y != 0) __y = y;
-            
             int width = config->getInt("width");
-            if (width != 0) __width = width;
-
             int height = config->getInt("height");
-            if (height != 0) __height = height;
-
             fullscreen = config->getBool("fullscreen");
 
-
+            if (fullscreen && width == 0 && height == 0)
+            {
+                // Use the screen resolution if fullscreen is true but width and height were not set in the config
+                int screen_num = DefaultScreen(__display);
+                width = DisplayWidth(__display, screen_num);
+                height = DisplayHeight(__display, screen_num);
+            }
+            if (x != 0) __x = x;
+            if (y != 0) __y = y;
+            if (width != 0) __width = width;
+            if (height != 0) __height = height;
         }
     }
 
-    // Get the display and initialize.
-    __display = XOpenDisplay(NULL);
-    if (__display == NULL)
-    {
-        perror("XOpenDisplay");
-        return NULL;
-    }
-
     // GLX version
     GLint majorGLX, minorGLX = 0;
     glXQueryVersion(__display, &majorGLX, &minorGLX);
-    if(majorGLX == 1 && minorGLX < 2)
+    if (majorGLX == 1 && minorGLX < 2)
     {
         perror("GLX 1.2 or greater is required.");
         XCloseDisplay(__display);
@@ -563,25 +566,25 @@ Platform* Platform::create(Game* game, void* attachToWindow)
 
     // Get the configs
     int configAttribs[] = 
-    { 
+    {
         GLX_RENDER_TYPE,    GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE,  GLX_WINDOW_BIT,
         GLX_X_RENDERABLE,   True,
-        GLX_DEPTH_SIZE,     24, 
+        GLX_DEPTH_SIZE,     24,
         GLX_STENCIL_SIZE,   8,
         GLX_RED_SIZE,       8,
         GLX_GREEN_SIZE,     8,
         GLX_BLUE_SIZE,      8,
         GLX_DOUBLEBUFFER,   True,
-        0 
+        0
     };
     GLXFBConfig* configs;
     int configCount = 0;
     configs = glXChooseFBConfig(__display, DefaultScreen(__display), configAttribs, &configCount);
-    if( configCount == 0 || configs == 0 )    
-    {    
+    if ( configCount == 0 || configs == 0 )
+    {
         perror( "glXChooseFBConfig" );
-        return NULL;    
+        return NULL;
     }
 
     // Create the windows
@@ -591,8 +594,8 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     XSetWindowAttributes winAttribs;
     long eventMask;
     eventMask = ExposureMask | VisibilityChangeMask | StructureNotifyMask |
-                KeyPressMask | KeyReleaseMask | PointerMotionMask | 
-                ButtonPressMask | ButtonReleaseMask | 
+                KeyPressMask | KeyReleaseMask | PointerMotionMask |
+                ButtonPressMask | ButtonReleaseMask |
                 EnterWindowMask | LeaveWindowMask;
     winAttribs.event_mask = eventMask;
     winAttribs.border_pixel = 0;
@@ -602,9 +605,9 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     GLint winMask;
     winMask = CWBorderPixel | CWBitGravity | CWEventMask| CWColormap;
    
-    __window = XCreateWindow(__display, DefaultRootWindow(__display), __x, __y, __width, __height, 0, 
+    __window = XCreateWindow(__display, DefaultRootWindow(__display), __x, __y, __width, __height, 0,
                             visualInfo->depth, InputOutput, visualInfo->visual, winMask,
-                            &winAttribs); 
+                            &winAttribs);
 
     // Tell the window manager that it should send the delete window notification through ClientMessage
     __atomWmDeleteWindow = XInternAtom(__display, "WM_DELETE_WINDOW", False);
@@ -635,7 +638,7 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     XStoreName(__display, __window, title ? title : "");
 
     __context = glXCreateContext(__display, visualInfo, NULL, True);
-    if(!__context)
+    if (!__context)
     {
         perror("glXCreateContext");
         return NULL;
@@ -645,7 +648,7 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     // Use OpenGL 2.x with GLEW
     glewExperimental = GL_TRUE;
     GLenum glewStatus = glewInit();
-    if(glewStatus != GLEW_OK)
+    if (glewStatus != GLEW_OK)
     {
         perror("glewInit");
         return NULL;
@@ -685,14 +688,14 @@ double timespec2millis(struct timespec *a)
     return (1000.0 * a->tv_sec) + (0.000001 * a->tv_nsec);
 }
 
-void updateWindowSize()    
-{    
-    GP_ASSERT(__display);    
+void updateWindowSize()
+{
+    GP_ASSERT(__display);
     GP_ASSERT(__window);
-    XWindowAttributes windowAttrs;    
-    XGetWindowAttributes(__display, __window, &windowAttrs);      
-    __windowSize[0] = windowAttrs.width;    
-    __windowSize[1] = windowAttrs.height;    
+    XWindowAttributes windowAttrs;
+    XGetWindowAttributes(__display, __window, &windowAttrs);
+    __windowSize[0] = windowAttrs.width;
+    __windowSize[1] = windowAttrs.height;
 }
 
 int Platform::enterMessagePump()
@@ -717,7 +720,7 @@ int Platform::enterMessagePump()
     // Run the game.
     _game->run();
 
-    // Setup select for message handling (to allow non-blocking)    
+    // Setup select for message handling (to allow non-blocking)
     int x11_fd = ConnectionNumber(__display);
     
     pollfd xpolls[1];
@@ -728,12 +731,12 @@ int Platform::enterMessagePump()
     while (true)
     {
         poll( xpolls, 1, 16 );
-        // handle all pending events in one block 
-        while (XPending(__display))    
+        // handle all pending events in one block
+        while (XPending(__display))
         {
            XNextEvent(__display, &evt);
         
-            switch (evt.type) 
+            switch (evt.type)
             {
             case ClientMessage:
                 {
@@ -751,7 +754,7 @@ int Platform::enterMessagePump()
                 }
                 break;
 
-            case Expose: 
+            case Expose:
                 {
                     updateWindowSize();
                 }
@@ -764,18 +767,18 @@ int Platform::enterMessagePump()
 
                     //TempSym needed because XConvertCase operates on two keysyms: One lower and the other upper, we are only interested in the upper case
                     KeySym tempSym;
-                    if(capsOn && !shiftDown)
+                    if (capsOn && !shiftDown)
                         XConvertCase(sym,  &tempSym, &sym);
 
                     Keyboard::Key key = getKey(sym);
                     gameplay::Platform::keyEventInternal(gameplay::Keyboard::KEY_PRESS, key);
 
-                    if(key == Keyboard::KEY_CAPS_LOCK)
+                    if (key == Keyboard::KEY_CAPS_LOCK)
                         capsOn = !capsOn;
-                    if(key == Keyboard::KEY_SHIFT)
+                    if (key == Keyboard::KEY_SHIFT)
                         shiftDown = true;
 
-                    if(int character = getUnicode(key))
+                    if (int character = getUnicode(key))
                         gameplay::Platform::keyEventInternal(gameplay::Keyboard::KEY_CHAR, character);
 
                 }
@@ -785,10 +788,10 @@ int Platform::enterMessagePump()
                 {
                     //detect and drop repeating keystrokes (no other way to do this using the event interface)
                     XEvent next;
-                    if( XPending(__display) )
+                    if ( XPending(__display) )
                     {
                         XPeekEvent(__display,&next);
-                        if( next.type == KeyPress 
+                        if ( next.type == KeyPress
                             && next.xkey.time == evt.xkey.time
                             && next.xkey.keycode == evt.xkey.keycode )
                         {
@@ -801,7 +804,7 @@ int Platform::enterMessagePump()
                     Keyboard::Key key = getKey(sym);
                     gameplay::Platform::keyEventInternal(gameplay::Keyboard::KEY_RELEASE, key);
 
-                    if(key == Keyboard::KEY_SHIFT)
+                    if (key == Keyboard::KEY_SHIFT)
                         shiftDown = false;
                 }
                 break;
@@ -809,7 +812,7 @@ int Platform::enterMessagePump()
             case ButtonPress:
                 {
                     gameplay::Mouse::MouseEvent mouseEvt;
-                    switch(evt.xbutton.button)
+                    switch (evt.xbutton.button)
                     {
                         case 1:
                             mouseEvt = gameplay::Mouse::MOUSE_PRESS_LEFT_BUTTON;
@@ -822,8 +825,8 @@ int Platform::enterMessagePump()
                             break;
                         case 4:
                         case 5:
-                            gameplay::Platform::mouseEventInternal(gameplay::Mouse::MOUSE_WHEEL, 
-                                                                   evt.xbutton.x, evt.xbutton.y, 
+                            gameplay::Platform::mouseEventInternal(gameplay::Mouse::MOUSE_WHEEL,
+                                                                   evt.xbutton.x, evt.xbutton.y,
                                                                    evt.xbutton.button == Button4 ? 1 : -1);
                             break;
                         default:
@@ -839,7 +842,7 @@ int Platform::enterMessagePump()
             case ButtonRelease:
                 {
                     gameplay::Mouse::MouseEvent mouseEvt;
-                    switch(evt.xbutton.button)
+                    switch (evt.xbutton.button)
                     {
                         case 1:
                             mouseEvt = gameplay::Mouse::MOUSE_RELEASE_LEFT_BUTTON;
@@ -862,25 +865,45 @@ int Platform::enterMessagePump()
         
             case MotionNotify:
                 {
-                    if (!gameplay::Platform::mouseEventInternal(gameplay::Mouse::MOUSE_MOVE, evt.xmotion.x, evt.xmotion.y, 0))
+                    int x = evt.xmotion.x;
+                    int y = evt.xmotion.y;
+
+                    if (__mouseCaptured)
+                    {
+                        if (x == __mouseCapturePointX && y == __mouseCapturePointY)
+                        {
+                            // Discard the first MotionNotify following capture
+                            // since it contains bogus x,y data.
+                            break;
+                        }
+
+                        // Convert to deltas
+                        x -= __mouseCapturePointX;
+                        y -= __mouseCapturePointY;
+
+                        // Warp mouse back to center of screen.
+                        XWarpPointer(__display, None, __window, 0, 0, 0, 0, __mouseCapturePointX, __mouseCapturePointY);
+                    }
+
+                    if (!gameplay::Platform::mouseEventInternal(gameplay::Mouse::MOUSE_MOVE, x, y, 0))
                     {
                         if (evt.xmotion.state & Button1Mask)
                         {
-                            gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_MOVE, evt.xmotion.x, evt.xmotion.y, 0);
+                            gameplay::Platform::touchEventInternal(gameplay::Touch::TOUCH_MOVE, x, y, 0);
                         }
                         else if (evt.xmotion.state & Button3Mask)
                         {
                             // Update the pitch and roll by adding the scaled deltas.
-                            __roll += (float)(evt.xbutton.x - lx) * ACCELEROMETER_X_FACTOR;
-                            __pitch += -(float)(evt.xbutton.y - ly) * ACCELEROMETER_Y_FACTOR;
+                            __roll += (float)(x - lx) * ACCELEROMETER_X_FACTOR;
+                            __pitch += -(float)(y - ly) * ACCELEROMETER_Y_FACTOR;
 
                             // Clamp the values to the valid range.
                             __roll = max(min(__roll, 90.0f), -90.0f);
                             __pitch = max(min(__pitch, 90.0f), -90.0f);
 
                             // Update the last X/Y values.
-                            lx = evt.xbutton.x;
-                            ly = evt.xbutton.y;
+                            lx = x;
+                            ly = y;
                         }
                     }
                 }
@@ -895,7 +918,7 @@ int Platform::enterMessagePump()
         {
             // Game state will be uninitialized if game was closed through Game::exit()
             if (_game->getState() == Game::UNINITIALIZED)
-                break;            
+                break;
             
             _game->frame();
         }
@@ -908,15 +931,15 @@ int Platform::enterMessagePump()
     return 0;
 }
     
-void Platform::signalShutdown() 
-{ 
+void Platform::signalShutdown()
+{
     // nothing to do  
 }
-
-bool Platform::canExit()
-{
-    return true;
-}
+
+bool Platform::canExit()
+{
+    return true;
+}
     
 unsigned int Platform::getDisplayWidth()
 {
@@ -992,13 +1015,31 @@ bool Platform::hasMouse()
 
 void Platform::setMouseCaptured(bool captured)
 {
-    // TODO
+    if (captured != __mouseCaptured)
+    {
+        if (captured)
+        {
+            // Hide the cursor and warp it to the center of the screen
+            __mouseCapturePointX = getDisplayWidth() / 2;
+            __mouseCapturePointY = getDisplayHeight() / 2;
+
+            setCursorVisible(false);
+            XWarpPointer(__display, None, __window, 0, 0, 0, 0, __mouseCapturePointX, __mouseCapturePointY);
+        }
+        else
+        {
+            // Restore cursor
+            XWarpPointer(__display, None, __window, 0, 0, 0, 0, __mouseCapturePointX, __mouseCapturePointY);
+            setCursorVisible(true);
+        }
+
+        __mouseCaptured = captured;
+    }
 }
 
 bool Platform::isMouseCaptured()
 {
-    // TODO
-    return false;
+    return __mouseCaptured;
 }
 
 void Platform::setCursorVisible(bool visible)
@@ -1007,7 +1048,17 @@ void Platform::setCursorVisible(bool visible)
     {
         if (visible)
         {
-            XDefineCursor(__display, __window, None);
+            Cursor invisibleCursor;
+            Pixmap bitmapNoData;
+            XColor black;
+            static char noData[] = {0, 0, 0, 0, 0, 0, 0, 0};
+            black.red = black.green = black.blue = 0;
+            bitmapNoData = XCreateBitmapFromData(__display, __window, noData, 8, 8);
+            invisibleCursor = XCreatePixmapCursor(__display, bitmapNoData, bitmapNoData, &black, &black, 0, 0);
+
+            XDefineCursor(__display, __window, invisibleCursor);
+            XFreeCursor(__display, invisibleCursor);
+            XFreePixmap(__display, bitmapNoData);
         }
         else
         {

+ 35 - 144
gameplay/src/PlatformMacOSX.mm

@@ -48,6 +48,7 @@ static char* __title = NULL;
 static bool __fullscreen = false;
 static void* __attachToWindow = NULL;
 static bool __mouseCaptured = false;
+static bool __mouseCapturedFirstPass = false;
 static CGPoint __mouseCapturePoint;
 static bool __cursorVisible = true;
 static View* __view = NULL;
@@ -582,7 +583,7 @@ double getMachTimeInMilliseconds()
 - (void)hidValueAvailable:(IOHIDValueRef)value
 {
     IOHIDElementRef element = IOHIDValueGetElement(value);
-	IOHIDElementCookie cookie = IOHIDElementGetCookie(element);
+    IOHIDElementCookie cookie = IOHIDElementGetCookie(element);
     
     if(IOHIDValueGetLength(value) > 4) return; // saftey precaution for PS3 cotroller
     CFIndex integerValue = IOHIDValueGetIntegerValue(value);
@@ -848,8 +849,17 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 {
     NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
     
+    float y;
     if (__mouseCaptured)
     {
+        if (__mouseCapturedFirstPass)
+        {
+            // Discard the first mouseMoved event following transition into capture
+            // since it contains bogus x,y data.
+            __mouseCapturedFirstPass = false;
+            return;
+        }
+
         point.x = [event deltaX];
         point.y = [event deltaY];
 
@@ -859,9 +869,14 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
         centerPoint.x = rect.origin.x + (rect.size.width / 2);
         centerPoint.y = rect.origin.y + (rect.size.height / 2);
         CGDisplayMoveCursorToPoint(CGDisplayPrimaryDisplay(NULL), centerPoint);
+        y = point.y;
+    }
+    else
+    {
+        y = __height - point.y;
     }
     
-    gameplay::Platform::mouseEventInternal(Mouse::MOUSE_MOVE, point.x, __height - point.y, 0);
+    gameplay::Platform::mouseEventInternal(Mouse::MOUSE_MOVE, point.x, y, 0);
 }
 
 - (void) mouseDragged: (NSEvent*) event
@@ -1461,6 +1476,12 @@ int Platform::enterMessagePump()
 
             // Read fullscreen state.
             __fullscreen = config->getBool("fullscreen");
+            if (__fullscreen && width == 0 && height == 0)
+            {
+                CGRect mainMonitor = CGDisplayBounds(CGMainDisplayID());
+                __width = CGRectGetWidth(mainMonitor);
+                __height = CGRectGetHeight(mainMonitor);
+            }
         }
     }
 
@@ -1603,6 +1624,7 @@ void Platform::setMouseCaptured(bool captured)
         if (captured)
         {
             [NSCursor hide];
+            __mouseCapturedFirstPass = true;
         }
         else
         {   
@@ -1726,139 +1748,8 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
      return [__view isGestureRegistered:evt];
 }
 
-unsigned int Platform::getGamepadsConnected()
-{
-    Game* game = Game::getInstance();
-    
-    if(game->isInitialized())
-    {
-        // Locate any newly connected devices
-        for(OSXGamepad* gamepad in __gamepads)
-        {
-            NSNumber* locationID = [gamepad locationID];
-            if([__activeGamepads objectForKey:locationID] == NULL)
-            {
-                unsigned int handle = game->createGamepad([[gamepad identifierName] cStringUsingEncoding:NSASCIIStringEncoding],
-                                                          [locationID unsignedIntValue],
-                                                          [gamepad numberOfButtons],
-                                                          [gamepad numberOfSticks],
-                                                          [gamepad numberOfTriggerButtons]);
-                NSNumber* handleObj = [NSNumber numberWithUnsignedInt:handle];
-                [__activeGamepads setObject:handleObj forKey:locationID];
-                game->gamepadEvent(Gamepad::CONNECTED_EVENT, game->getGamepad(handle));
-            }
-        }
-        
-        // Detect any disconnected gamepads
-        NSMutableArray* deadGamepads = [NSMutableArray array];
-        for(NSNumber* locationID in __activeGamepads)
-        {
-            OSXGamepad* gamepad = gamepadForLocationID(locationID);
-            if(gamepad == NULL)
-            {
-                NSNumber* gameHandle = [__activeGamepads objectForKey:locationID];
-                game->gamepadEvent(Gamepad::DISCONNECTED_EVENT, game->getGamepad([gameHandle unsignedIntValue]));
-                [deadGamepads addObject:locationID];
-            }
-        }
-        [__activeGamepads removeObjectsForKeys:deadGamepads];
-    }
-    return [__gamepads count];
-}
-
-bool Platform::isGamepadConnected(unsigned int gamepadHandle)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    return (gamepad != NULL);
-}
-
-const char* Platform::getGamepadId(unsigned int gamepadHandle)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    if(gamepad)
-    {
-        return [[gamepad productName] cStringUsingEncoding:NSASCIIStringEncoding];
-    }
-    return NULL;
-}
-
-unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    if(gamepad)
-    {
-        return [gamepad numberOfButtons];
-    }
-    return 0;
-}
-
-bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    OSXGamepadButton* button = [gamepad buttonAtIndex:buttonIndex];
-    if(button)
-    {
-        return [button state];
-    }
-    return false;
-}
-
-unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    if(gamepad)
-    {
-        return [gamepad numberOfSticks];
-    }
-    return 0;
-}
-
-bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return true;
-}
-
-float Platform::getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    OSXGamepadAxis* xAxis = [gamepad axisAtIndex:(joystickIndex*2)];
-    return [xAxis calibratedValue];
-}
-
-float Platform::getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    OSXGamepadAxis* yAxis = [gamepad axisAtIndex:((joystickIndex*2)+1)];
-    return [yAxis calibratedValue];
-}
-
-void Platform::getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValue)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    OSXGamepadAxis* xAxis = [gamepad axisAtIndex:(joystickIndex*2)];
-    OSXGamepadAxis* yAxis = [gamepad axisAtIndex:((joystickIndex*2)+1)];
-    if(outValue)
-    {
-        outValue->x = [xAxis calibratedValue];
-        outValue->y = [yAxis calibratedValue];
-    }
-}
-
-unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+void Platform::pollGamepadState(Gamepad* gamepad)
 {
-    OSXGamepad *gamepad = gamepadForLocationIDValue(gamepadHandle);
-    return [gamepad numberOfTriggerButtons];
-}
-
-float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
-{
-    OSXGamepad* gamepad = gamepadForLocationIDValue(gamepadHandle);
-    OSXGamepadButton* button = [gamepad triggerButtonAtIndex:triggerIndex];
-    if(button)
-    {
-        return [button stateValue];
-    }
-    return 0.0f;
 }
 
 }
@@ -1942,25 +1833,25 @@ CFMutableDictionaryRef IOHIDCreateDeviceMatchingDictionary(UInt32 inUsagePage, U
 
 CFStringRef IOHIDDeviceGetStringProperty(IOHIDDeviceRef deviceRef, CFStringRef key) 
 {
-	CFTypeRef typeRef = IOHIDDeviceGetProperty(deviceRef, key);
-	if (typeRef == NULL || CFGetTypeID(typeRef) != CFNumberGetTypeID()) 
+    CFTypeRef typeRef = IOHIDDeviceGetProperty(deviceRef, key);
+    if (typeRef == NULL || CFGetTypeID(typeRef) != CFNumberGetTypeID()) 
     {
-		return NULL;
-	}
+        return NULL;
+    }
     return (CFStringRef)typeRef;
 }
 
 int IOHIDDeviceGetIntProperty(IOHIDDeviceRef deviceRef, CFStringRef key) 
 {
-	CFTypeRef typeRef = IOHIDDeviceGetProperty(deviceRef, key);
-	if (typeRef == NULL || CFGetTypeID(typeRef) != CFNumberGetTypeID()) 
+    CFTypeRef typeRef = IOHIDDeviceGetProperty(deviceRef, key);
+    if (typeRef == NULL || CFGetTypeID(typeRef) != CFNumberGetTypeID()) 
     {
-		return 0;
-	}
+        return 0;
+    }
     
     int value;
-	CFNumberGetValue((CFNumberRef) typeRef, kCFNumberSInt32Type, &value);
-	return value;
+    CFNumberGetValue((CFNumberRef) typeRef, kCFNumberSInt32Type, &value);
+    return value;
 }
 
 static void hidDeviceDiscoveredCallback(void* inContext, IOReturn inResult, void* inSender, IOHIDDeviceRef inIOHIDDeviceRef) 

+ 148 - 325
gameplay/src/PlatformWindows.cpp

@@ -40,78 +40,13 @@ static bool __cursorVisible = true;
 static unsigned int __gamepadsConnected = 0;
 
 #ifdef USE_XINPUT
-struct XInputGamepad
-{
-    static const unsigned int BUTTON_COUNT = 14;
-    static const unsigned int JOYSTICK_COUNT = 2;
-    static const unsigned int TRIGGER_COUNT = 2;
-    std::string id;
-    int handle;
-    bool connected;
-    XINPUT_STATE state;
-};
-
-static XInputGamepad* __xinputGamepads = NULL;
-
-static DWORD getXInputGamepadButtonMask(unsigned int buttonHandle)
-{
-    switch(buttonHandle)
-    {
-    case 0:
-        return XINPUT_GAMEPAD_DPAD_UP;
-    case 1:
-        return XINPUT_GAMEPAD_DPAD_DOWN;
-    case 2:
-        return XINPUT_GAMEPAD_DPAD_LEFT;
-    case 3:
-        return XINPUT_GAMEPAD_DPAD_RIGHT;
-    case 4:
-        return XINPUT_GAMEPAD_START;
-    case 5:
-        return XINPUT_GAMEPAD_BACK;
-    case 6:
-        return XINPUT_GAMEPAD_LEFT_THUMB;
-    case 7:
-        return XINPUT_GAMEPAD_RIGHT_THUMB;
-    case 8:
-        return XINPUT_GAMEPAD_LEFT_SHOULDER;
-    case 9:
-        return XINPUT_GAMEPAD_RIGHT_SHOULDER;
-    case 10:
-        return XINPUT_GAMEPAD_A;
-    case 11:
-        return XINPUT_GAMEPAD_B;
-    case 12:
-        return XINPUT_GAMEPAD_X;
-    case 13:
-        return XINPUT_GAMEPAD_Y;
-    default:
-        return 0;
-    }
-}
-
-static bool getXInputState(unsigned long gamepadHandle)
-{
-    GP_ASSERT(0 <= gamepadHandle && gamepadHandle < XUSER_MAX_COUNT);
-
-    if (XInputGetState((DWORD)gamepadHandle, &__xinputGamepads[gamepadHandle].state) == ERROR_SUCCESS)
-        return (__xinputGamepads[gamepadHandle].connected = true);
-    else
-        return (__xinputGamepads[gamepadHandle].connected = false);
-}
-
-static bool getXInputButtonState(unsigned long gamepadHandle, unsigned long buttonHandle)
-{
-    GP_ASSERT(0 <= gamepadHandle && gamepadHandle < XUSER_MAX_COUNT);
-    GP_ASSERT(0 <= buttonHandle && buttonHandle < 14);
-    
-    WORD buttonMask = getXInputGamepadButtonMask(buttonHandle); // Conversion to button mask.
+static const unsigned int XINPUT_BUTTON_COUNT = 14;
+static const unsigned int XINPUT_JOYSTICK_COUNT = 2;
+static const unsigned int XINPUT_TRIGGER_COUNT = 2;
+#endif
 
-    if ((__xinputGamepads[gamepadHandle].state.Gamepad.wButtons & buttonMask) == buttonMask)
-        return true;
-    else
-        return false;
-}
+#ifdef USE_XINPUT
+static XINPUT_STATE __xInputState;
 
 static float normalizeXInputJoystickAxis(int axisValue, int deadZone)
 {
@@ -124,61 +59,23 @@ static float normalizeXInputJoystickAxis(int axisValue, int deadZone)
     else
     {
         int value = axisValue;
+        int maxVal;
         if (value < 0)
+        {
             value = -1;
+            maxVal = 32768;
+        }
         else if (value > 0)
+        {
             value = 1;
+            maxVal = 32767;
+        }
         else
-            value = 0;
-        return value * (absAxisValue - deadZone) / (float)(32768 - deadZone);
-    }
-}
-
-static float getXInputJoystickAxisX(unsigned long gamepadHandle, unsigned long joystickHandle)
-{
-    GP_ASSERT(0 <= gamepadHandle && gamepadHandle < XUSER_MAX_COUNT);
-    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
-    
-    switch(joystickHandle)
-    {
-    case 0:
-        return normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbLX, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
-    case 1:
-        return normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbRX, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
-    default: return 0.0f;
-    }
-}
-
-static float getXInputJoystickAxisY(unsigned long gamepadHandle, unsigned long joystickHandle)
-{
-    GP_ASSERT(0 <= gamepadHandle && gamepadHandle < XUSER_MAX_COUNT);
-    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
-
-    switch(joystickHandle)
-    {
-    case 0:
-        return normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbLY, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
-    case 1:
-        return normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbRY, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
-    default: return 0.0f;
-    }
-}
-
-static void getXInputJoystickAxisValues(unsigned long gamepadHandle, unsigned long joystickHandle, gameplay::Vector2* outValue)
-{
-    GP_ASSERT(0 <= gamepadHandle && gamepadHandle < XUSER_MAX_COUNT);
-    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
+        {
+            return 0;
+        }
 
-    switch(joystickHandle)
-    {
-    case 0:
-        outValue->x = normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbLX, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
-        outValue->y = normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbLY, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
-        break;
-    case 1:
-        outValue->x = normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbRX, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
-        outValue->y = normalizeXInputJoystickAxis(__xinputGamepads[gamepadHandle].state.Gamepad.sThumbRY, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
-        break;
+        return value * (absAxisValue - deadZone) / (float)(maxVal - deadZone);
     }
 }
 #endif
@@ -405,7 +302,7 @@ static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
     }
 }
 
-void UpdateCapture(LPARAM lParam)
+static void UpdateCapture(LPARAM lParam)
 {
     if ((lParam & MK_LBUTTON) || (lParam & MK_MBUTTON) || (lParam & MK_RBUTTON))
         SetCapture(__hwnd);
@@ -413,13 +310,27 @@ void UpdateCapture(LPARAM lParam)
         ReleaseCapture();
 }
 
-void WarpMouse(int clientX, int clientY)
+static void WarpMouse(int clientX, int clientY)
 {
     POINT p = { clientX, clientY };
     ClientToScreen(__hwnd, &p);
     SetCursorPos(p.x, p.y);
 }
 
+
+/**
+ * Gets the width and height of the screen in pixels.
+ */
+static void getDesktopResolution(int& width, int& height)
+{
+   RECT desktop;
+   const HWND hDesktop = GetDesktopWindow();
+   // Get the size of screen to the variable desktop
+   GetWindowRect(hDesktop, &desktop);
+   width = desktop.right;
+   height = desktop.bottom;
+}
+
 LRESULT CALLBACK __WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
     static gameplay::Game* game = gameplay::Game::getInstance();
@@ -633,9 +544,6 @@ Platform::~Platform()
         DestroyWindow(__hwnd);
         __hwnd = 0;
     }
-#ifdef USE_XINPUT
-    SAFE_DELETE_ARRAY(__xinputGamepads);
-#endif
 }
 
 bool createWindow(WindowCreationParams* params, HWND* hwnd, HDC* hdc)
@@ -872,6 +780,11 @@ Platform* Platform::create(Game* game, void* attachToWindow)
                 SAFE_DELETE_ARRAY(wtitle);
             }
 
+            // Read fullscreen state.
+            params.fullscreen = config->getBool("fullscreen");
+            // Read multisampling state.
+            params.samples = config->getInt("samples");
+
             // Read window rect.
             int x = config->getInt("x");
             if (x != 0)
@@ -880,17 +793,15 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             if (y != 0)
                 params.rect.top = y;
             int width = config->getInt("width");
+            int height = config->getInt("height");
+
+            if (width == 0 && height == 0 && params.fullscreen)
+                getDesktopResolution(width, height);
+
             if (width != 0)
                 params.rect.right = params.rect.left + width;
-            int height = config->getInt("height");
             if (height != 0)
                 params.rect.bottom = params.rect.top + height;
-
-            // Read fullscreen state.
-            params.fullscreen = config->getBool("fullscreen");
-
-            // Read multisampling state.
-            params.samples = config->getInt("samples");
         }
     }
 
@@ -961,9 +872,9 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             DEVMODE dm;
             memset(&dm, 0, sizeof(dm));
             dm.dmSize= sizeof(dm);
-            dm.dmPelsWidth	= width;
-            dm.dmPelsHeight	= height;
-            dm.dmBitsPerPel	= DEFAULT_COLOR_BUFFER_SIZE;
+            dm.dmPelsWidth  = width;
+            dm.dmPelsHeight = height;
+            dm.dmBitsPerPel = DEFAULT_COLOR_BUFFER_SIZE;
             dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
 
             // Try to set selected mode and get results. NOTE: CDS_FULLSCREEN gets rid of start bar.
@@ -995,26 +906,16 @@ Platform* Platform::create(Game* game, void* attachToWindow)
 
 #ifdef USE_XINPUT
     // Initialize XInputGamepads.
-    __xinputGamepads = new XInputGamepad[XUSER_MAX_COUNT];
-    for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
+    for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
     {
-        switch(i)
+        if (XInputGetState(i, &__xInputState) == NO_ERROR)
         {
-        case 0:
-            __xinputGamepads[i].id = "XINPUT 1";
-            break;
-        case 1:
-            __xinputGamepads[i].id = "XINPUT 2";
-            break;
-        case 2:
-            __xinputGamepads[i].id = "XINPUT 3";
-            break;
-        case 3:
-            __xinputGamepads[i].id = "XINPUT 4";
-            break;
+            // Gamepad is connected.
+            char id[9];
+            sprintf(id, "XInput %d", i);
+            Gamepad::add(id, i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT,
+                         0, 0, "Unknown", "XInput Gamepad");
         }
-        __xinputGamepads[i].connected = false;
-        __xinputGamepads[i].handle = -1;
     }
 #endif
 
@@ -1068,6 +969,21 @@ int Platform::enterMessagePump()
         }
         else
         {
+#ifdef USE_XINPUT
+            // Check for connected XInput gamepads.
+            for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
+            {
+                if (XInputGetState(i, &__xInputState) == NO_ERROR && !Gamepad::getGamepad(i))
+                {
+                    // Gamepad was just connected.
+                    char id[9];
+                    sprintf(id, "XInput %d", i);
+                    Gamepad::add(id, i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT,
+                                    0, 0, "Unknown", "XInput Gamepad");
+                }
+            }
+#endif
+
             _game->frame();
             SwapBuffers(__hdc);
         }
@@ -1230,197 +1146,104 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
     return false;
 }
 
-unsigned int Platform::getGamepadsConnected()
+#ifdef USE_XINPUT
+void Platform::pollGamepadState(Gamepad* gamepad)
 {
-    // Check to see what xbox360 gamepads are connected.
-    __gamepadsConnected = 0;
+    GP_ASSERT(gamepad->_handle < XUSER_MAX_COUNT);
 
-#ifdef USE_XINPUT
-    for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
+    if (XInputGetState(gamepad->_handle, &__xInputState) == NO_ERROR)
     {
-        if (isGamepadConnected(i))
-            __gamepadsConnected++;
-    }    
-#endif
-    return __gamepadsConnected;
-}
+        WORD buttons = __xInputState.Gamepad.wButtons;
+
+        // Map XInput buttons to Gamepad::ButtonMappings enum.
+        static const unsigned int xInputMapping[16] = {
+            Gamepad::BUTTON_UP,    // 0x0001
+            Gamepad::BUTTON_DOWN,  // 0x0002
+            Gamepad::BUTTON_LEFT,  // 0x0004
+            Gamepad::BUTTON_RIGHT, // 0x0008
+            Gamepad::BUTTON_MENU2, // 0x0010
+            Gamepad::BUTTON_MENU1, // 0x0020
+            Gamepad::BUTTON_L3,    // 0x0040
+            Gamepad::BUTTON_R3,    // 0x0080
+            Gamepad::BUTTON_L1,    // 0x0100
+            Gamepad::BUTTON_R1,    // 0x0200
+            0,
+            0,
+            Gamepad::BUTTON_A,     // 0x1000
+            Gamepad::BUTTON_B,     // 0x2000
+            Gamepad::BUTTON_X,     // 0x4000
+            Gamepad::BUTTON_Y      // 0x8000
+        };
+
+        const unsigned int *mapping = xInputMapping;
+        for (gamepad->_buttons = 0; buttons; buttons >>= 1, mapping++)
+        {
+            if (buttons & 1)
+            {
+                gamepad->_buttons |= (1 << *mapping);
+            }
+        }
 
-bool Platform::isGamepadConnected(unsigned int gamepadHandle)
-{
+        unsigned int i;
+        for (i = 0; i < gamepad->_joystickCount; ++i)
+        {
+            GP_ASSERT(i < 2);
 
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-    Game* game = Game::getInstance();
-    GP_ASSERT(game);
+            float x;
+            float y;
+            switch (i)
+            {
+            case 0:
+                x = normalizeXInputJoystickAxis(__xInputState.Gamepad.sThumbLX, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+                y = normalizeXInputJoystickAxis(__xInputState.Gamepad.sThumbLY, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+                break;
+            case 1:
+                x = normalizeXInputJoystickAxis(__xInputState.Gamepad.sThumbRX, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+                y = normalizeXInputJoystickAxis(__xInputState.Gamepad.sThumbRY, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+                break;
+            }
 
-    if (__xinputGamepads[gamepadHandle].handle == -1)
-        __xinputGamepads[gamepadHandle].handle = game->createGamepad(__xinputGamepads[gamepadHandle].id.c_str(), gamepadHandle, __xinputGamepads[gamepadHandle].BUTTON_COUNT, 
-            __xinputGamepads[gamepadHandle].JOYSTICK_COUNT, __xinputGamepads[gamepadHandle].TRIGGER_COUNT);
+            gamepad->_joysticks[i].set(x, y);
+        }
 
-    bool isConnected = __xinputGamepads[gamepadHandle].connected;
-    if (getXInputState(gamepadHandle))
-    {
-        if (!isConnected)
+        for (i = 0; i < gamepad->_triggerCount; ++i)
         {
-            __xinputGamepads[gamepadHandle].connected = true;
-            
-            Gamepad* gamepad = game->getGamepad(__xinputGamepads[gamepadHandle].handle);
-            GP_ASSERT(gamepad);
-            if (game->isInitialized())
-                game->gamepadEvent(Gamepad::CONNECTED_EVENT, game->getGamepad(__xinputGamepads[gamepadHandle].handle)); 
+            GP_ASSERT(i < 2);
+
+            BYTE trigger;
+            switch (i)
+            {
+            case 0:
+                trigger = __xInputState.Gamepad.bLeftTrigger;
+                break;
+            case 1:
+                trigger = __xInputState.Gamepad.bRightTrigger;
+                break;
+            }
+
+            if (trigger < XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
+            {
+                gamepad->_triggers[i] = 0.0f;
+            }
+            else
+            {
+                gamepad->_triggers[i] = (float)trigger / 255.0f;
+            }
         }
-        return true;
     }
     else
     {
-        if (isConnected)
-        {
-            // if it was connected, but now isn't pass the detached event to gamepadEvent()
-            __xinputGamepads[gamepadHandle].connected = false;
-            
-            Gamepad* gamepad = game->getGamepad(__xinputGamepads[gamepadHandle].handle);
-            GP_ASSERT(gamepad);
-            if (game->isInitialized())
-                game->gamepadEvent(Gamepad::DISCONNECTED_EVENT, game->getGamepad(__xinputGamepads[gamepadHandle].handle));
-        }
-        return false;
+        // Gamepad was disconnected.
+        Gamepad::remove(gamepad);
     }
-#endif
-
-    return false;
-}
-
-const char* Platform::getGamepadId(unsigned int gamepadHandle) 
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    return __xinputGamepads[gamepadHandle].id.c_str();
-#endif
-    return NULL;
-}
-
-unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-    if (!__xinputGamepads[gamepadHandle].connected)
-        return 0;
-
-    return XInputGamepad::BUTTON_COUNT;
-#endif
-
-    return 0;
-}
-
-bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-    return getXInputButtonState(gamepadHandle, buttonIndex);
-#endif
-
-    return false;
-}
-
-unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    if (!__xinputGamepads[gamepadHandle].connected)
-        return 0;
-
-    return XInputGamepad::JOYSTICK_COUNT;
-#endif
-
-    return 0;
 }
-
-float Platform::getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex)
+#else
+void Platform::pollGamepadState(Gamepad* gamepad)
 {
-    
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    return getXInputJoystickAxisX(gamepadHandle, joystickIndex);
-#endif 
-
-    return 0.0f;
+    // TODO: Support generic HID gamepads (including XBox controllers) without requiring XInput.
 }
-
-float Platform::getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    return getXInputJoystickAxisY(gamepadHandle, joystickIndex);
-#endif
-
-    return 0.0f;
-}
-
-void Platform::getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValue)
-{
-    
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    getXInputJoystickAxisValues(gamepadHandle, joystickIndex, outValue);
 #endif
 
-}
-
-bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    return (getXInputJoystickAxisX(gamepadHandle, joystickIndex) != 0.0f || getXInputJoystickAxisY(gamepadHandle, joystickIndex) != 0.0f);
-#endif 
-
-    return false;
-}
-
-unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
-{
-
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-
-    return XInputGamepad::TRIGGER_COUNT;
-#endif
-
-    return 0;
-}
-
-float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
-{
-    
-#ifdef USE_XINPUT
-    GP_ASSERT(0 <= gamepadHandle);
-    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
-    //TODO:
-#endif
-    return 0.0f;
-}
-
 void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     if (!Form::touchEventInternal(evt, x, y, contactIndex))

+ 1 - 57
gameplay/src/PlatformiOS.mm

@@ -1391,64 +1391,8 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
     return [__view isGestureRegistered:evt];
 }
 
-
-unsigned int Platform::getGamepadsConnected()
-{
-    return 0;
-}
-
-bool Platform::isGamepadConnected(unsigned int gamepadHandle)
-{
-    return false;
-}
-
-const char* Platform::getGamepadId(unsigned int gamepadHandle)
-{
-    return NULL;
-}
-
-unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
-{
-    return false;
-}
-
-unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return false;
-}
-
-float Platform::getGamepadJoystickAxisX(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-float Platform::getGamepadJoystickAxisY(unsigned int gamepadHandle, unsigned int joystickIndex)
-{
-    return 0.0f;
-}
-
-void Platform::getGamepadJoystickAxisValues(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* outValue)
-{
-}
-
-unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
-{
-    return 0;
-}
-
-float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+void Platform::pollGamepadState(Gamepad* gamepad)
 {
-    return 0.0f;
 }
 
 bool Platform::launchURL(const char *url)

+ 5 - 5
gameplay/src/RenderState.h

@@ -92,7 +92,7 @@ public:
      *
      * Functions matching this callback signature can be registered via the 
      * RenderState::registerAutoBindingResolver method to extend or override the set
-     * of built-in material paramter auto bindings.
+     * of built-in material parameter auto bindings.
      *
      * @param autoBinding Name of the auto binding to resolve.
      * @param node Node that is bound to the material of the specified parameter.
@@ -309,11 +309,11 @@ public:
     /**
      * Registers a custom auto binding resolver.
      *
-     * Implementing a custom auto binding reolver allows the set of built-in parameter auto
+     * Implementing a custom auto binding resolver allows the set of built-in parameter auto
      * bindings to be extended or overridden. Any parameter auto binding that is set on a
      * material will be forwarded to any custom auto binding resolvers, in the order in which
      * they are registered. If a registered resolver returns true (specifying that it handles
-     * the specified autoBinding), no further code will be exeucted for that autoBinding.
+     * the specified autoBinding), no further code will be executed for that autoBinding.
      * This allows auto binding resolvers to not only implement new/custom binding strings,
      * but it also lets them override existing/built-in ones. For this reason, you should
      * ensure that you ONLY return true if you explicitly handle a custom auto binding; return
@@ -324,7 +324,7 @@ public:
      * Model that belongs to a Node. The resolver is NOT called each frame or each time
      * the RenderState is bound. Therefore, when implementing custom auto bindings for values
      * that change over time, the you should bind a method pointer onto the passed in
-     * MaterialParaemter using the MaterialParameter::bindValue mehtod. This way, the bound 
+     * MaterialParaemter using the MaterialParameter::bindValue method. This way, the bound
      * method will be called each frame to set an updated value into the MaterialParameter.
      *
      * If no registered resolvers explicitly handle an auto binding, the binding will attempt
@@ -436,7 +436,7 @@ protected:
     RenderState* _parent;
 
     /**
-     * Map of custom auto binding resolverss.
+     * Map of custom auto binding resolvers.
      */
     static std::vector<ResolveAutoBindingCallback> _customAutoBindingResolvers;
 };

+ 2 - 2
gameplay/src/Scene.h

@@ -74,7 +74,7 @@ public:
      * @param id The ID of the node to find.
      * @param nodes Vector of nodes to be populated with matches.
      * @param recursive true if a recursive search should be performed, false otherwise.
-     * @param exactMatch true if only nodes whos ID exactly matches the specified ID are returned,
+     * @param exactMatch true if only nodes who's ID exactly matches the specified ID are returned,
      *      or false if nodes that start with the given ID are returned.
      * 
      * @return The number of matches found.
@@ -212,7 +212,7 @@ public:
     /**
      * Draws debugging information (bounding volumes, etc.) for the scene.
      *
-     * @param debugFlags Bitwise combination of debug flags from mthe DebugFlags 
+     * @param debugFlags Bitwise combination of debug flags from the DebugFlags
      *        enumeration, specifying which debugging information to draw.
      */
     void drawDebug(unsigned int debugFlags);

+ 1 - 1
gameplay/src/ScriptController.h

@@ -57,7 +57,7 @@ public:
     LuaArray(int count);
 
     /**
-     * Copy construcotr.
+     * Copy constructor.
      */
     LuaArray(const LuaArray<T>& copy);
 

+ 8 - 7
gameplay/src/SpriteBatch.cpp

@@ -73,12 +73,12 @@ SpriteBatch::~SpriteBatch()
 SpriteBatch* SpriteBatch::create(const char* texturePath, Effect* effect, unsigned int initialCapacity)
 {
     Texture* texture = Texture::create(texturePath);
-    SpriteBatch* batch = SpriteBatch::create(texture);
+    SpriteBatch* batch = SpriteBatch::create(texture, effect, initialCapacity);
     SAFE_RELEASE(texture);
     return batch;
 }
 
-SpriteBatch* SpriteBatch::create(Texture* texture, Effect* effect, unsigned int initialCapacity)
+SpriteBatch* SpriteBatch::create(Texture* texture,  Effect* effect, unsigned int initialCapacity)
 {
     GP_ASSERT(texture != NULL);
 
@@ -154,10 +154,11 @@ SpriteBatch* SpriteBatch::create(Texture* texture, Effect* effect, unsigned int
     batch->_textureWidthRatio = 1.0f / (float)texture->getWidth();
     batch->_textureHeightRatio = 1.0f / (float)texture->getHeight();
 
-    // Bind an ortho projection to the material by default (user can override with setProjectionMatrix)
-    Game* game = Game::getInstance();
-    Matrix::createOrthographicOffCenter(0, game->getWidth(), game->getHeight(), 0, 0, 1, &batch->_projectionMatrix);
-    material->getParameter("u_projectionMatrix")->bindValue(batch, &SpriteBatch::getProjectionMatrix);
+	// Bind an ortho projection to the material by default (user can override with setProjectionMatrix)
+	Game* game = Game::getInstance();
+	Matrix::createOrthographicOffCenter(0, game->getWidth(), game->getHeight(), 0, 0, 1, &batch->_projectionMatrix);
+	material->getParameter("u_projectionMatrix")->bindValue(batch, &SpriteBatch::getProjectionMatrix);
+	
     return batch;
 }
 
@@ -185,7 +186,7 @@ void SpriteBatch::draw(const Vector3& dst, const Rectangle& src, const Vector2&
     float u2 = u1 + _textureWidthRatio * src.width;
     float v2 = v1 - _textureHeightRatio * src.height;
 
-    draw(dst.x, dst.y, dst.z, scale.x, scale.y, u2, v2, u1, v1, color);
+    draw(dst.x, dst.y, dst.z, scale.x, scale.y, u1, v1, u2, v2, color);
 }
 
 void SpriteBatch::draw(const Vector3& dst, const Rectangle& src, const Vector2& scale, const Vector4& color,

+ 3 - 3
gameplay/src/Stream.h

@@ -21,7 +21,7 @@ public:
     virtual ~Stream() {};
 
     /**
-     * Returns true if this stream can preform read operations.
+     * Returns true if this stream can perform read operations.
      * 
      * @return True if the stream can read, false otherwise.
      */
@@ -91,7 +91,7 @@ public:
      *     print("Error writing to file");
      * \endcode
      * 
-     * @param ptr   The poiner to the array of elements to be written.
+     * @param ptr   The pointer to the array of elements to be written.
      * @param size  The size of each element to be written, in bytes.
      * @param count The number of elements to write.
      * 
@@ -133,7 +133,7 @@ public:
      * 
      * @param offset The number of bytes to offset from origin.
      * @param origin The position used as a reference for offset.
-     *               The supported vaules are the same as fseek().
+     *               The supported values are the same as fseek().
      *                - <code>SEEK_SET</code> relative to the beginning of the file.
      *                - <code>SEEK_CUR</code> relative to the current position of the file pointer.
      *                - <code>SEEK_END</code> relative to the end of file.

+ 1 - 1
gameplay/src/Transform.h

@@ -682,7 +682,7 @@ public:
     void translateUp(float amount);
 
     /**
-     * Translates the camera foward by the specified amount in the z-axis.
+     * Translates the camera forward by the specified amount in the z-axis.
      *
      * @param amount The amount to translate.
      */

+ 1 - 1
gameplay/src/Vector2.cpp

@@ -171,7 +171,7 @@ Vector2& Vector2::normalize()
     return *this;
 }
 
-void Vector2::normalize(Vector2* dst)
+void Vector2::normalize(Vector2* dst) const
 {
     GP_ASSERT(dst);
 

+ 1 - 1
gameplay/src/Vector2.h

@@ -245,7 +245,7 @@ public:
      *
      * @param dst The destination vector.
      */
-    void normalize(Vector2* dst);
+    void normalize(Vector2* dst) const;
 
     /**
      * Scales all elements of this vector by the specified value.

+ 1 - 1
gameplay/src/Vector4.cpp

@@ -239,7 +239,7 @@ Vector4& Vector4::normalize()
     return *this;
 }
 
-void Vector4::normalize(Vector4* dst)
+void Vector4::normalize(Vector4* dst) const
 {
     GP_ASSERT(dst);
 

+ 1 - 1
gameplay/src/Vector4.h

@@ -283,7 +283,7 @@ public:
      *
      * @param dst The destination vector.
      */
-    void normalize(Vector4* dst);
+    void normalize(Vector4* dst) const;
 
     /**
      * Scales all elements of this vector by the specified value.

+ 111 - 66
gameplay/src/lua/lua_Button.cpp

@@ -7,6 +7,7 @@
 #include "Button.h"
 #include "Control.h"
 #include "Game.h"
+#include "Gamepad.h"
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
@@ -32,8 +33,6 @@ void luaRegister_Button()
         {"createAnimationFromBy", lua_Button_createAnimationFromBy},
         {"createAnimationFromTo", lua_Button_createAnimationFromTo},
         {"destroyAnimation", lua_Button_destroyAnimation},
-        {"disable", lua_Button_disable},
-        {"enable", lua_Button_enable},
         {"getAlignment", lua_Button_getAlignment},
         {"getAnimation", lua_Button_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Button_getAnimationPropertyComponentCount},
@@ -74,6 +73,7 @@ void luaRegister_Button()
         {"getZIndex", lua_Button_getZIndex},
         {"isContainer", lua_Button_isContainer},
         {"isEnabled", lua_Button_isEnabled},
+        {"isVisible", lua_Button_isVisible},
         {"release", lua_Button_release},
         {"removeListener", lua_Button_removeListener},
         {"removeScriptCallback", lua_Button_removeScriptCallback},
@@ -86,6 +86,7 @@ void luaRegister_Button()
         {"setConsumeInputEvents", lua_Button_setConsumeInputEvents},
         {"setCursorColor", lua_Button_setCursorColor},
         {"setCursorRegion", lua_Button_setCursorRegion},
+        {"setEnabled", lua_Button_setEnabled},
         {"setFocusIndex", lua_Button_setFocusIndex},
         {"setFont", lua_Button_setFont},
         {"setFontSize", lua_Button_setFontSize},
@@ -105,6 +106,7 @@ void luaRegister_Button()
         {"setTextAlignment", lua_Button_setTextAlignment},
         {"setTextColor", lua_Button_setTextColor},
         {"setTextRightToLeft", lua_Button_setTextRightToLeft},
+        {"setVisible", lua_Button_setVisible},
         {"setWidth", lua_Button_setWidth},
         {"setZIndex", lua_Button_setZIndex},
         {NULL, NULL}
@@ -678,70 +680,6 @@ int lua_Button_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Button_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Button* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Button_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Button_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Button* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Button_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Button_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2619,6 +2557,41 @@ int lua_Button_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_Button_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Button_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3171,6 +3144,42 @@ int lua_Button_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Button_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Button_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4201,6 +4210,42 @@ int lua_Button_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Button_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Button_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Button.h

@@ -13,8 +13,6 @@ int lua_Button_createAnimation(lua_State* state);
 int lua_Button_createAnimationFromBy(lua_State* state);
 int lua_Button_createAnimationFromTo(lua_State* state);
 int lua_Button_destroyAnimation(lua_State* state);
-int lua_Button_disable(lua_State* state);
-int lua_Button_enable(lua_State* state);
 int lua_Button_getAlignment(lua_State* state);
 int lua_Button_getAnimation(lua_State* state);
 int lua_Button_getAnimationPropertyComponentCount(lua_State* state);
@@ -55,6 +53,7 @@ int lua_Button_getY(lua_State* state);
 int lua_Button_getZIndex(lua_State* state);
 int lua_Button_isContainer(lua_State* state);
 int lua_Button_isEnabled(lua_State* state);
+int lua_Button_isVisible(lua_State* state);
 int lua_Button_release(lua_State* state);
 int lua_Button_removeListener(lua_State* state);
 int lua_Button_removeScriptCallback(lua_State* state);
@@ -67,6 +66,7 @@ int lua_Button_setBounds(lua_State* state);
 int lua_Button_setConsumeInputEvents(lua_State* state);
 int lua_Button_setCursorColor(lua_State* state);
 int lua_Button_setCursorRegion(lua_State* state);
+int lua_Button_setEnabled(lua_State* state);
 int lua_Button_setFocusIndex(lua_State* state);
 int lua_Button_setFont(lua_State* state);
 int lua_Button_setFontSize(lua_State* state);
@@ -86,6 +86,7 @@ int lua_Button_setText(lua_State* state);
 int lua_Button_setTextAlignment(lua_State* state);
 int lua_Button_setTextColor(lua_State* state);
 int lua_Button_setTextRightToLeft(lua_State* state);
+int lua_Button_setVisible(lua_State* state);
 int lua_Button_setWidth(lua_State* state);
 int lua_Button_setZIndex(lua_State* state);
 int lua_Button_static_ANIMATE_OPACITY(lua_State* state);

+ 111 - 66
gameplay/src/lua/lua_CheckBox.cpp

@@ -8,6 +8,7 @@
 #include "CheckBox.h"
 #include "Control.h"
 #include "Game.h"
+#include "Gamepad.h"
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
@@ -33,8 +34,6 @@ void luaRegister_CheckBox()
         {"createAnimationFromBy", lua_CheckBox_createAnimationFromBy},
         {"createAnimationFromTo", lua_CheckBox_createAnimationFromTo},
         {"destroyAnimation", lua_CheckBox_destroyAnimation},
-        {"disable", lua_CheckBox_disable},
-        {"enable", lua_CheckBox_enable},
         {"getAlignment", lua_CheckBox_getAlignment},
         {"getAnimation", lua_CheckBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_CheckBox_getAnimationPropertyComponentCount},
@@ -78,6 +77,7 @@ void luaRegister_CheckBox()
         {"isChecked", lua_CheckBox_isChecked},
         {"isContainer", lua_CheckBox_isContainer},
         {"isEnabled", lua_CheckBox_isEnabled},
+        {"isVisible", lua_CheckBox_isVisible},
         {"release", lua_CheckBox_release},
         {"removeListener", lua_CheckBox_removeListener},
         {"removeScriptCallback", lua_CheckBox_removeScriptCallback},
@@ -91,6 +91,7 @@ void luaRegister_CheckBox()
         {"setConsumeInputEvents", lua_CheckBox_setConsumeInputEvents},
         {"setCursorColor", lua_CheckBox_setCursorColor},
         {"setCursorRegion", lua_CheckBox_setCursorRegion},
+        {"setEnabled", lua_CheckBox_setEnabled},
         {"setFocusIndex", lua_CheckBox_setFocusIndex},
         {"setFont", lua_CheckBox_setFont},
         {"setFontSize", lua_CheckBox_setFontSize},
@@ -111,6 +112,7 @@ void luaRegister_CheckBox()
         {"setTextAlignment", lua_CheckBox_setTextAlignment},
         {"setTextColor", lua_CheckBox_setTextColor},
         {"setTextRightToLeft", lua_CheckBox_setTextRightToLeft},
+        {"setVisible", lua_CheckBox_setVisible},
         {"setWidth", lua_CheckBox_setWidth},
         {"setZIndex", lua_CheckBox_setZIndex},
         {NULL, NULL}
@@ -684,70 +686,6 @@ int lua_CheckBox_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_CheckBox_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                CheckBox* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_CheckBox_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                CheckBox* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_CheckBox_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2739,6 +2677,41 @@ int lua_CheckBox_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_CheckBox_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3327,6 +3300,42 @@ int lua_CheckBox_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_CheckBox_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4397,6 +4406,42 @@ int lua_CheckBox_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_CheckBox_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_CheckBox.h

@@ -13,8 +13,6 @@ int lua_CheckBox_createAnimation(lua_State* state);
 int lua_CheckBox_createAnimationFromBy(lua_State* state);
 int lua_CheckBox_createAnimationFromTo(lua_State* state);
 int lua_CheckBox_destroyAnimation(lua_State* state);
-int lua_CheckBox_disable(lua_State* state);
-int lua_CheckBox_enable(lua_State* state);
 int lua_CheckBox_getAlignment(lua_State* state);
 int lua_CheckBox_getAnimation(lua_State* state);
 int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state);
@@ -58,6 +56,7 @@ int lua_CheckBox_getZIndex(lua_State* state);
 int lua_CheckBox_isChecked(lua_State* state);
 int lua_CheckBox_isContainer(lua_State* state);
 int lua_CheckBox_isEnabled(lua_State* state);
+int lua_CheckBox_isVisible(lua_State* state);
 int lua_CheckBox_release(lua_State* state);
 int lua_CheckBox_removeListener(lua_State* state);
 int lua_CheckBox_removeScriptCallback(lua_State* state);
@@ -71,6 +70,7 @@ int lua_CheckBox_setChecked(lua_State* state);
 int lua_CheckBox_setConsumeInputEvents(lua_State* state);
 int lua_CheckBox_setCursorColor(lua_State* state);
 int lua_CheckBox_setCursorRegion(lua_State* state);
+int lua_CheckBox_setEnabled(lua_State* state);
 int lua_CheckBox_setFocusIndex(lua_State* state);
 int lua_CheckBox_setFont(lua_State* state);
 int lua_CheckBox_setFontSize(lua_State* state);
@@ -91,6 +91,7 @@ int lua_CheckBox_setText(lua_State* state);
 int lua_CheckBox_setTextAlignment(lua_State* state);
 int lua_CheckBox_setTextColor(lua_State* state);
 int lua_CheckBox_setTextRightToLeft(lua_State* state);
+int lua_CheckBox_setVisible(lua_State* state);
 int lua_CheckBox_setWidth(lua_State* state);
 int lua_CheckBox_setZIndex(lua_State* state);
 int lua_CheckBox_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_Container.cpp

@@ -45,8 +45,6 @@ void luaRegister_Container()
         {"createAnimationFromBy", lua_Container_createAnimationFromBy},
         {"createAnimationFromTo", lua_Container_createAnimationFromTo},
         {"destroyAnimation", lua_Container_destroyAnimation},
-        {"disable", lua_Container_disable},
-        {"enable", lua_Container_enable},
         {"getAlignment", lua_Container_getAlignment},
         {"getAnimation", lua_Container_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Container_getAnimationPropertyComponentCount},
@@ -93,6 +91,7 @@ void luaRegister_Container()
         {"isEnabled", lua_Container_isEnabled},
         {"isScrollBarsAutoHide", lua_Container_isScrollBarsAutoHide},
         {"isScrolling", lua_Container_isScrolling},
+        {"isVisible", lua_Container_isVisible},
         {"release", lua_Container_release},
         {"removeControl", lua_Container_removeControl},
         {"removeListener", lua_Container_removeListener},
@@ -106,6 +105,7 @@ void luaRegister_Container()
         {"setConsumeInputEvents", lua_Container_setConsumeInputEvents},
         {"setCursorColor", lua_Container_setCursorColor},
         {"setCursorRegion", lua_Container_setCursorRegion},
+        {"setEnabled", lua_Container_setEnabled},
         {"setFocusIndex", lua_Container_setFocusIndex},
         {"setFont", lua_Container_setFont},
         {"setFontSize", lua_Container_setFontSize},
@@ -126,6 +126,7 @@ void luaRegister_Container()
         {"setTextAlignment", lua_Container_setTextAlignment},
         {"setTextColor", lua_Container_setTextColor},
         {"setTextRightToLeft", lua_Container_setTextRightToLeft},
+        {"setVisible", lua_Container_setVisible},
         {"setWidth", lua_Container_setWidth},
         {"setZIndex", lua_Container_setZIndex},
         {NULL, NULL}
@@ -745,70 +746,6 @@ int lua_Container_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Container_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Container* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Container_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Container_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Container* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Container_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Container_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2959,6 +2896,41 @@ int lua_Container_isScrolling(lua_State* state)
     return 0;
 }
 
+int lua_Container_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Container* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Container_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3583,6 +3555,42 @@ int lua_Container_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Container_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Container* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Container_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4649,6 +4657,42 @@ int lua_Container_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Container_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Container* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Container_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Container.h

@@ -14,8 +14,6 @@ int lua_Container_createAnimation(lua_State* state);
 int lua_Container_createAnimationFromBy(lua_State* state);
 int lua_Container_createAnimationFromTo(lua_State* state);
 int lua_Container_destroyAnimation(lua_State* state);
-int lua_Container_disable(lua_State* state);
-int lua_Container_enable(lua_State* state);
 int lua_Container_getAlignment(lua_State* state);
 int lua_Container_getAnimation(lua_State* state);
 int lua_Container_getAnimationPropertyComponentCount(lua_State* state);
@@ -62,6 +60,7 @@ int lua_Container_isContainer(lua_State* state);
 int lua_Container_isEnabled(lua_State* state);
 int lua_Container_isScrollBarsAutoHide(lua_State* state);
 int lua_Container_isScrolling(lua_State* state);
+int lua_Container_isVisible(lua_State* state);
 int lua_Container_release(lua_State* state);
 int lua_Container_removeControl(lua_State* state);
 int lua_Container_removeListener(lua_State* state);
@@ -75,6 +74,7 @@ int lua_Container_setBounds(lua_State* state);
 int lua_Container_setConsumeInputEvents(lua_State* state);
 int lua_Container_setCursorColor(lua_State* state);
 int lua_Container_setCursorRegion(lua_State* state);
+int lua_Container_setEnabled(lua_State* state);
 int lua_Container_setFocusIndex(lua_State* state);
 int lua_Container_setFont(lua_State* state);
 int lua_Container_setFontSize(lua_State* state);
@@ -95,6 +95,7 @@ int lua_Container_setStyle(lua_State* state);
 int lua_Container_setTextAlignment(lua_State* state);
 int lua_Container_setTextColor(lua_State* state);
 int lua_Container_setTextRightToLeft(lua_State* state);
+int lua_Container_setVisible(lua_State* state);
 int lua_Container_setWidth(lua_State* state);
 int lua_Container_setZIndex(lua_State* state);
 int lua_Container_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_Control.cpp

@@ -30,8 +30,6 @@ void luaRegister_Control()
         {"createAnimationFromBy", lua_Control_createAnimationFromBy},
         {"createAnimationFromTo", lua_Control_createAnimationFromTo},
         {"destroyAnimation", lua_Control_destroyAnimation},
-        {"disable", lua_Control_disable},
-        {"enable", lua_Control_enable},
         {"getAlignment", lua_Control_getAlignment},
         {"getAnimation", lua_Control_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Control_getAnimationPropertyComponentCount},
@@ -72,6 +70,7 @@ void luaRegister_Control()
         {"getZIndex", lua_Control_getZIndex},
         {"isContainer", lua_Control_isContainer},
         {"isEnabled", lua_Control_isEnabled},
+        {"isVisible", lua_Control_isVisible},
         {"release", lua_Control_release},
         {"removeListener", lua_Control_removeListener},
         {"removeScriptCallback", lua_Control_removeScriptCallback},
@@ -84,6 +83,7 @@ void luaRegister_Control()
         {"setConsumeInputEvents", lua_Control_setConsumeInputEvents},
         {"setCursorColor", lua_Control_setCursorColor},
         {"setCursorRegion", lua_Control_setCursorRegion},
+        {"setEnabled", lua_Control_setEnabled},
         {"setFocusIndex", lua_Control_setFocusIndex},
         {"setFont", lua_Control_setFont},
         {"setFontSize", lua_Control_setFontSize},
@@ -102,6 +102,7 @@ void luaRegister_Control()
         {"setTextAlignment", lua_Control_setTextAlignment},
         {"setTextColor", lua_Control_setTextColor},
         {"setTextRightToLeft", lua_Control_setTextRightToLeft},
+        {"setVisible", lua_Control_setVisible},
         {"setWidth", lua_Control_setWidth},
         {"setZIndex", lua_Control_setZIndex},
         {NULL, NULL}
@@ -674,70 +675,6 @@ int lua_Control_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Control_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Control* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Control_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Control_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Control* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Control_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Control_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2615,6 +2552,41 @@ int lua_Control_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_Control_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Control* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Control_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3167,6 +3139,42 @@ int lua_Control_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Control_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Control* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Control_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4161,6 +4169,42 @@ int lua_Control_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Control_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Control* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Control_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Control.h

@@ -13,8 +13,6 @@ int lua_Control_createAnimation(lua_State* state);
 int lua_Control_createAnimationFromBy(lua_State* state);
 int lua_Control_createAnimationFromTo(lua_State* state);
 int lua_Control_destroyAnimation(lua_State* state);
-int lua_Control_disable(lua_State* state);
-int lua_Control_enable(lua_State* state);
 int lua_Control_getAlignment(lua_State* state);
 int lua_Control_getAnimation(lua_State* state);
 int lua_Control_getAnimationPropertyComponentCount(lua_State* state);
@@ -55,6 +53,7 @@ int lua_Control_getY(lua_State* state);
 int lua_Control_getZIndex(lua_State* state);
 int lua_Control_isContainer(lua_State* state);
 int lua_Control_isEnabled(lua_State* state);
+int lua_Control_isVisible(lua_State* state);
 int lua_Control_release(lua_State* state);
 int lua_Control_removeListener(lua_State* state);
 int lua_Control_removeScriptCallback(lua_State* state);
@@ -67,6 +66,7 @@ int lua_Control_setBounds(lua_State* state);
 int lua_Control_setConsumeInputEvents(lua_State* state);
 int lua_Control_setCursorColor(lua_State* state);
 int lua_Control_setCursorRegion(lua_State* state);
+int lua_Control_setEnabled(lua_State* state);
 int lua_Control_setFocusIndex(lua_State* state);
 int lua_Control_setFont(lua_State* state);
 int lua_Control_setFontSize(lua_State* state);
@@ -85,6 +85,7 @@ int lua_Control_setStyle(lua_State* state);
 int lua_Control_setTextAlignment(lua_State* state);
 int lua_Control_setTextColor(lua_State* state);
 int lua_Control_setTextRightToLeft(lua_State* state);
+int lua_Control_setVisible(lua_State* state);
 int lua_Control_setWidth(lua_State* state);
 int lua_Control_setZIndex(lua_State* state);
 int lua_Control_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_Form.cpp

@@ -48,9 +48,7 @@ void luaRegister_Form()
         {"createAnimationFromBy", lua_Form_createAnimationFromBy},
         {"createAnimationFromTo", lua_Form_createAnimationFromTo},
         {"destroyAnimation", lua_Form_destroyAnimation},
-        {"disable", lua_Form_disable},
         {"draw", lua_Form_draw},
-        {"enable", lua_Form_enable},
         {"getAlignment", lua_Form_getAlignment},
         {"getAnimation", lua_Form_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Form_getAnimationPropertyComponentCount},
@@ -98,6 +96,7 @@ void luaRegister_Form()
         {"isEnabled", lua_Form_isEnabled},
         {"isScrollBarsAutoHide", lua_Form_isScrollBarsAutoHide},
         {"isScrolling", lua_Form_isScrolling},
+        {"isVisible", lua_Form_isVisible},
         {"release", lua_Form_release},
         {"removeControl", lua_Form_removeControl},
         {"removeListener", lua_Form_removeListener},
@@ -111,6 +110,7 @@ void luaRegister_Form()
         {"setConsumeInputEvents", lua_Form_setConsumeInputEvents},
         {"setCursorColor", lua_Form_setCursorColor},
         {"setCursorRegion", lua_Form_setCursorRegion},
+        {"setEnabled", lua_Form_setEnabled},
         {"setFocusIndex", lua_Form_setFocusIndex},
         {"setFont", lua_Form_setFont},
         {"setFontSize", lua_Form_setFontSize},
@@ -132,6 +132,7 @@ void luaRegister_Form()
         {"setTextAlignment", lua_Form_setTextAlignment},
         {"setTextColor", lua_Form_setTextColor},
         {"setTextRightToLeft", lua_Form_setTextRightToLeft},
+        {"setVisible", lua_Form_setVisible},
         {"setWidth", lua_Form_setWidth},
         {"setZIndex", lua_Form_setZIndex},
         {"update", lua_Form_update},
@@ -753,38 +754,6 @@ int lua_Form_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Form_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Form* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Form_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Form_draw(lua_State* state)
 {
     // Get the number of parameters.
@@ -817,38 +786,6 @@ int lua_Form_draw(lua_State* state)
     return 0;
 }
 
-int lua_Form_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Form* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Form_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Form_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -3043,6 +2980,41 @@ int lua_Form_isScrolling(lua_State* state)
     return 0;
 }
 
+int lua_Form_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Form* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Form_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3667,6 +3639,42 @@ int lua_Form_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Form_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Form* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Form_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4775,6 +4783,42 @@ int lua_Form_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Form_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Form* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Form_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Form.h

@@ -14,9 +14,7 @@ int lua_Form_createAnimation(lua_State* state);
 int lua_Form_createAnimationFromBy(lua_State* state);
 int lua_Form_createAnimationFromTo(lua_State* state);
 int lua_Form_destroyAnimation(lua_State* state);
-int lua_Form_disable(lua_State* state);
 int lua_Form_draw(lua_State* state);
-int lua_Form_enable(lua_State* state);
 int lua_Form_getAlignment(lua_State* state);
 int lua_Form_getAnimation(lua_State* state);
 int lua_Form_getAnimationPropertyComponentCount(lua_State* state);
@@ -64,6 +62,7 @@ int lua_Form_isContainer(lua_State* state);
 int lua_Form_isEnabled(lua_State* state);
 int lua_Form_isScrollBarsAutoHide(lua_State* state);
 int lua_Form_isScrolling(lua_State* state);
+int lua_Form_isVisible(lua_State* state);
 int lua_Form_release(lua_State* state);
 int lua_Form_removeControl(lua_State* state);
 int lua_Form_removeListener(lua_State* state);
@@ -77,6 +76,7 @@ int lua_Form_setBounds(lua_State* state);
 int lua_Form_setConsumeInputEvents(lua_State* state);
 int lua_Form_setCursorColor(lua_State* state);
 int lua_Form_setCursorRegion(lua_State* state);
+int lua_Form_setEnabled(lua_State* state);
 int lua_Form_setFocusIndex(lua_State* state);
 int lua_Form_setFont(lua_State* state);
 int lua_Form_setFontSize(lua_State* state);
@@ -98,6 +98,7 @@ int lua_Form_setStyle(lua_State* state);
 int lua_Form_setTextAlignment(lua_State* state);
 int lua_Form_setTextColor(lua_State* state);
 int lua_Form_setTextRightToLeft(lua_State* state);
+int lua_Form_setVisible(lua_State* state);
 int lua_Form_setWidth(lua_State* state);
 int lua_Form_setZIndex(lua_State* state);
 int lua_Form_static_ANIMATE_OPACITY(lua_State* state);

+ 0 - 121
gameplay/src/lua/lua_Game.cpp

@@ -40,9 +40,6 @@ void luaRegister_Game()
         {"getAudioListener", lua_Game_getAudioListener},
         {"getConfig", lua_Game_getConfig},
         {"getFrameRate", lua_Game_getFrameRate},
-        {"getGamepad", lua_Game_getGamepad},
-        {"getGamepadCount", lua_Game_getGamepadCount},
-        {"getGamepadsConnected", lua_Game_getGamepadsConnected},
         {"getHeight", lua_Game_getHeight},
         {"getPhysicsController", lua_Game_getPhysicsController},
         {"getScriptController", lua_Game_getScriptController},
@@ -870,124 +867,6 @@ int lua_Game_getFrameRate(lua_State* state)
     return 0;
 }
 
-int lua_Game_getGamepad(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                Game* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getGamepad(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Gamepad");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Game_getGamepad - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Game_getGamepadCount(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Game* instance = getInstance(state);
-                unsigned int result = instance->getGamepadCount();
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Game_getGamepadCount - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Game_getGamepadsConnected(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Game* instance = getInstance(state);
-                unsigned int result = instance->getGamepadsConnected();
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Game_getGamepadsConnected - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Game_getHeight(lua_State* state)
 {
     // Get the number of parameters.

+ 0 - 3
gameplay/src/lua/lua_Game.h

@@ -23,9 +23,6 @@ int lua_Game_getAudioController(lua_State* state);
 int lua_Game_getAudioListener(lua_State* state);
 int lua_Game_getConfig(lua_State* state);
 int lua_Game_getFrameRate(lua_State* state);
-int lua_Game_getGamepad(lua_State* state);
-int lua_Game_getGamepadCount(lua_State* state);
-int lua_Game_getGamepadsConnected(lua_State* state);
 int lua_Game_getHeight(lua_State* state);
 int lua_Game_getPhysicsController(lua_State* state);
 int lua_Game_getScriptController(lua_State* state);

+ 205 - 63
gameplay/src/lua/lua_Gamepad.cpp

@@ -2,9 +2,10 @@
 #include "ScriptController.h"
 #include "lua_Gamepad.h"
 #include "Base.h"
+#include "Button.h"
 #include "Game.h"
 #include "Gamepad.h"
-#include "lua_GamepadButtonState.h"
+#include "lua_GamepadButtonMapping.h"
 
 namespace gameplay
 {
@@ -15,19 +16,26 @@ void luaRegister_Gamepad()
     {
         {"draw", lua_Gamepad_draw},
         {"getButtonCount", lua_Gamepad_getButtonCount},
-        {"getButtonState", lua_Gamepad_getButtonState},
         {"getForm", lua_Gamepad_getForm},
         {"getId", lua_Gamepad_getId},
-        {"getJoystickAxisValues", lua_Gamepad_getJoystickAxisValues},
-        {"getJoystickAxisX", lua_Gamepad_getJoystickAxisX},
-        {"getJoystickAxisY", lua_Gamepad_getJoystickAxisY},
         {"getJoystickCount", lua_Gamepad_getJoystickCount},
-        {"isJoystickActive", lua_Gamepad_isJoystickActive},
+        {"getJoystickValues", lua_Gamepad_getJoystickValues},
+        {"getProductId", lua_Gamepad_getProductId},
+        {"getProductString", lua_Gamepad_getProductString},
+        {"getTriggerCount", lua_Gamepad_getTriggerCount},
+        {"getTriggerValue", lua_Gamepad_getTriggerValue},
+        {"getVendorId", lua_Gamepad_getVendorId},
+        {"getVendorString", lua_Gamepad_getVendorString},
+        {"isButtonDown", lua_Gamepad_isButtonDown},
         {"isVirtual", lua_Gamepad_isVirtual},
         {"update", lua_Gamepad_update},
         {NULL, NULL}
     };
-    const luaL_Reg* lua_statics = NULL;
+    const luaL_Reg lua_statics[] = 
+    {
+        {"getGamepads", lua_Gamepad_static_getGamepads},
+        {NULL, NULL}
+    };
     std::vector<std::string> scopePath;
 
     ScriptUtil::registerClass("Gamepad", lua_members, NULL, NULL, lua_statics, scopePath);
@@ -107,7 +115,7 @@ int lua_Gamepad_getButtonCount(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getButtonState(lua_State* state)
+int lua_Gamepad_getForm(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -115,30 +123,35 @@ int lua_Gamepad_getButtonState(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 2:
+        case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER)
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
-
                 Gamepad* instance = getInstance(state);
-                Gamepad::ButtonState result = instance->getButtonState(param1);
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_GamepadButtonState(result));
+                void* returnPtr = (void*)instance->getForm();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Form");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
 
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getButtonState - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getForm - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
             lua_error(state);
             break;
         }
@@ -146,7 +159,7 @@ int lua_Gamepad_getButtonState(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getForm(lua_State* state)
+int lua_Gamepad_getId(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -159,24 +172,15 @@ int lua_Gamepad_getForm(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Gamepad* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getForm();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Form");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
+                const char* result = instance->getId();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
 
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getForm - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getId - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -190,7 +194,7 @@ int lua_Gamepad_getForm(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getId(lua_State* state)
+int lua_Gamepad_getJoystickCount(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -203,15 +207,15 @@ int lua_Gamepad_getId(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Gamepad* instance = getInstance(state);
-                const char* result = instance->getId();
+                unsigned int result = instance->getJoystickCount();
 
                 // Push the return value onto the stack.
-                lua_pushstring(state, result);
+                lua_pushunsigned(state, result);
 
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getId - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getJoystickCount - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -225,7 +229,7 @@ int lua_Gamepad_getId(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getJoystickAxisValues(lua_State* state)
+int lua_Gamepad_getJoystickValues(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -252,12 +256,12 @@ int lua_Gamepad_getJoystickAxisValues(lua_State* state)
                 }
 
                 Gamepad* instance = getInstance(state);
-                instance->getJoystickAxisValues(param1, param2);
+                instance->getJoystickValues(param1, param2);
                 
                 return 0;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getJoystickAxisValues - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getJoystickValues - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -271,7 +275,7 @@ int lua_Gamepad_getJoystickAxisValues(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getJoystickAxisX(lua_State* state)
+int lua_Gamepad_getProductId(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -279,30 +283,96 @@ int lua_Gamepad_getJoystickAxisX(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 2:
+        case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER)
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+                Gamepad* instance = getInstance(state);
+                unsigned int result = instance->getProductId();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Gamepad_getProductId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Gamepad_getProductString(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Gamepad* instance = getInstance(state);
+                const char* result = instance->getProductString();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Gamepad_getProductString - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Gamepad_getTriggerCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
 
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
                 Gamepad* instance = getInstance(state);
-                float result = instance->getJoystickAxisX(param1);
+                unsigned int result = instance->getTriggerCount();
 
                 // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                lua_pushunsigned(state, result);
 
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getJoystickAxisX - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getTriggerCount - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
             lua_error(state);
             break;
         }
@@ -310,7 +380,7 @@ int lua_Gamepad_getJoystickAxisX(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getJoystickAxisY(lua_State* state)
+int lua_Gamepad_getTriggerValue(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -327,7 +397,7 @@ int lua_Gamepad_getJoystickAxisY(lua_State* state)
                 unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
 
                 Gamepad* instance = getInstance(state);
-                float result = instance->getJoystickAxisY(param1);
+                float result = instance->getTriggerValue(param1);
 
                 // Push the return value onto the stack.
                 lua_pushnumber(state, result);
@@ -335,7 +405,7 @@ int lua_Gamepad_getJoystickAxisY(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getJoystickAxisY - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getTriggerValue - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -349,7 +419,7 @@ int lua_Gamepad_getJoystickAxisY(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getJoystickCount(lua_State* state)
+int lua_Gamepad_getVendorId(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -362,7 +432,7 @@ int lua_Gamepad_getJoystickCount(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
                 Gamepad* instance = getInstance(state);
-                unsigned int result = instance->getJoystickCount();
+                unsigned int result = instance->getVendorId();
 
                 // Push the return value onto the stack.
                 lua_pushunsigned(state, result);
@@ -370,7 +440,7 @@ int lua_Gamepad_getJoystickCount(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_getJoystickCount - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_getVendorId - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -384,7 +454,42 @@ int lua_Gamepad_getJoystickCount(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_isJoystickActive(lua_State* state)
+int lua_Gamepad_getVendorString(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Gamepad* instance = getInstance(state);
+                const char* result = instance->getVendorString();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Gamepad_getVendorString - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Gamepad_isButtonDown(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -395,13 +500,13 @@ int lua_Gamepad_isJoystickActive(lua_State* state)
         case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+                Gamepad::ButtonMapping param1 = (Gamepad::ButtonMapping)lua_enumFromString_GamepadButtonMapping(luaL_checkstring(state, 2));
 
                 Gamepad* instance = getInstance(state);
-                bool result = instance->isJoystickActive(param1);
+                bool result = instance->isButtonDown(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -409,7 +514,7 @@ int lua_Gamepad_isJoystickActive(lua_State* state)
                 return 1;
             }
 
-            lua_pushstring(state, "lua_Gamepad_isJoystickActive - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Gamepad_isButtonDown - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             break;
         }
@@ -458,6 +563,43 @@ int lua_Gamepad_isVirtual(lua_State* state)
     return 0;
 }
 
+int lua_Gamepad_static_getGamepads(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 0:
+        {
+            void* returnPtr = (void*)Gamepad::getGamepads();
+            if (returnPtr)
+            {
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                object->instance = returnPtr;
+                object->owns = false;
+                luaL_getmetatable(state, "Gamepad");
+                lua_setmetatable(state, -2);
+            }
+            else
+            {
+                lua_pushnil(state);
+            }
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Gamepad_update(lua_State* state)
 {
     // Get the number of parameters.

+ 9 - 5
gameplay/src/lua/lua_Gamepad.h

@@ -7,15 +7,19 @@ namespace gameplay
 // Lua bindings for Gamepad.
 int lua_Gamepad_draw(lua_State* state);
 int lua_Gamepad_getButtonCount(lua_State* state);
-int lua_Gamepad_getButtonState(lua_State* state);
 int lua_Gamepad_getForm(lua_State* state);
 int lua_Gamepad_getId(lua_State* state);
-int lua_Gamepad_getJoystickAxisValues(lua_State* state);
-int lua_Gamepad_getJoystickAxisX(lua_State* state);
-int lua_Gamepad_getJoystickAxisY(lua_State* state);
 int lua_Gamepad_getJoystickCount(lua_State* state);
-int lua_Gamepad_isJoystickActive(lua_State* state);
+int lua_Gamepad_getJoystickValues(lua_State* state);
+int lua_Gamepad_getProductId(lua_State* state);
+int lua_Gamepad_getProductString(lua_State* state);
+int lua_Gamepad_getTriggerCount(lua_State* state);
+int lua_Gamepad_getTriggerValue(lua_State* state);
+int lua_Gamepad_getVendorId(lua_State* state);
+int lua_Gamepad_getVendorString(lua_State* state);
+int lua_Gamepad_isButtonDown(lua_State* state);
 int lua_Gamepad_isVirtual(lua_State* state);
+int lua_Gamepad_static_getGamepads(lua_State* state);
 int lua_Gamepad_update(lua_State* state);
 
 void luaRegister_Gamepad();

+ 123 - 0
gameplay/src/lua/lua_GamepadButtonMapping.cpp

@@ -0,0 +1,123 @@
+#include "Base.h"
+#include "lua_GamepadButtonMapping.h"
+
+namespace gameplay
+{
+
+static const char* enumStringEmpty = "";
+
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_A = "BUTTON_A";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_B = "BUTTON_B";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_C = "BUTTON_C";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_X = "BUTTON_X";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_Y = "BUTTON_Y";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_Z = "BUTTON_Z";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_MENU1 = "BUTTON_MENU1";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_MENU2 = "BUTTON_MENU2";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_MENU3 = "BUTTON_MENU3";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_MENU4 = "BUTTON_MENU4";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_L1 = "BUTTON_L1";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_L2 = "BUTTON_L2";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_L3 = "BUTTON_L3";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_R1 = "BUTTON_R1";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_R2 = "BUTTON_R2";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_R3 = "BUTTON_R3";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_UP = "BUTTON_UP";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_DOWN = "BUTTON_DOWN";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_LEFT = "BUTTON_LEFT";
+static const char* luaEnumString_GamepadButtonMapping_BUTTON_RIGHT = "BUTTON_RIGHT";
+
+Gamepad::ButtonMapping lua_enumFromString_GamepadButtonMapping(const char* s)
+{
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_A) == 0)
+        return Gamepad::BUTTON_A;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_B) == 0)
+        return Gamepad::BUTTON_B;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_C) == 0)
+        return Gamepad::BUTTON_C;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_X) == 0)
+        return Gamepad::BUTTON_X;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_Y) == 0)
+        return Gamepad::BUTTON_Y;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_Z) == 0)
+        return Gamepad::BUTTON_Z;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_MENU1) == 0)
+        return Gamepad::BUTTON_MENU1;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_MENU2) == 0)
+        return Gamepad::BUTTON_MENU2;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_MENU3) == 0)
+        return Gamepad::BUTTON_MENU3;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_MENU4) == 0)
+        return Gamepad::BUTTON_MENU4;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_L1) == 0)
+        return Gamepad::BUTTON_L1;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_L2) == 0)
+        return Gamepad::BUTTON_L2;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_L3) == 0)
+        return Gamepad::BUTTON_L3;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_R1) == 0)
+        return Gamepad::BUTTON_R1;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_R2) == 0)
+        return Gamepad::BUTTON_R2;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_R3) == 0)
+        return Gamepad::BUTTON_R3;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_UP) == 0)
+        return Gamepad::BUTTON_UP;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_DOWN) == 0)
+        return Gamepad::BUTTON_DOWN;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_LEFT) == 0)
+        return Gamepad::BUTTON_LEFT;
+    if (strcmp(s, luaEnumString_GamepadButtonMapping_BUTTON_RIGHT) == 0)
+        return Gamepad::BUTTON_RIGHT;
+    GP_ERROR("Invalid enumeration value '%s' for enumeration Gamepad::ButtonMapping.", s);
+    return Gamepad::BUTTON_A;
+}
+
+const char* lua_stringFromEnum_GamepadButtonMapping(Gamepad::ButtonMapping e)
+{
+    if (e == Gamepad::BUTTON_A)
+        return luaEnumString_GamepadButtonMapping_BUTTON_A;
+    if (e == Gamepad::BUTTON_B)
+        return luaEnumString_GamepadButtonMapping_BUTTON_B;
+    if (e == Gamepad::BUTTON_C)
+        return luaEnumString_GamepadButtonMapping_BUTTON_C;
+    if (e == Gamepad::BUTTON_X)
+        return luaEnumString_GamepadButtonMapping_BUTTON_X;
+    if (e == Gamepad::BUTTON_Y)
+        return luaEnumString_GamepadButtonMapping_BUTTON_Y;
+    if (e == Gamepad::BUTTON_Z)
+        return luaEnumString_GamepadButtonMapping_BUTTON_Z;
+    if (e == Gamepad::BUTTON_MENU1)
+        return luaEnumString_GamepadButtonMapping_BUTTON_MENU1;
+    if (e == Gamepad::BUTTON_MENU2)
+        return luaEnumString_GamepadButtonMapping_BUTTON_MENU2;
+    if (e == Gamepad::BUTTON_MENU3)
+        return luaEnumString_GamepadButtonMapping_BUTTON_MENU3;
+    if (e == Gamepad::BUTTON_MENU4)
+        return luaEnumString_GamepadButtonMapping_BUTTON_MENU4;
+    if (e == Gamepad::BUTTON_L1)
+        return luaEnumString_GamepadButtonMapping_BUTTON_L1;
+    if (e == Gamepad::BUTTON_L2)
+        return luaEnumString_GamepadButtonMapping_BUTTON_L2;
+    if (e == Gamepad::BUTTON_L3)
+        return luaEnumString_GamepadButtonMapping_BUTTON_L3;
+    if (e == Gamepad::BUTTON_R1)
+        return luaEnumString_GamepadButtonMapping_BUTTON_R1;
+    if (e == Gamepad::BUTTON_R2)
+        return luaEnumString_GamepadButtonMapping_BUTTON_R2;
+    if (e == Gamepad::BUTTON_R3)
+        return luaEnumString_GamepadButtonMapping_BUTTON_R3;
+    if (e == Gamepad::BUTTON_UP)
+        return luaEnumString_GamepadButtonMapping_BUTTON_UP;
+    if (e == Gamepad::BUTTON_DOWN)
+        return luaEnumString_GamepadButtonMapping_BUTTON_DOWN;
+    if (e == Gamepad::BUTTON_LEFT)
+        return luaEnumString_GamepadButtonMapping_BUTTON_LEFT;
+    if (e == Gamepad::BUTTON_RIGHT)
+        return luaEnumString_GamepadButtonMapping_BUTTON_RIGHT;
+    GP_ERROR("Invalid enumeration value '%d' for enumeration Gamepad::ButtonMapping.", e);
+    return enumStringEmpty;
+}
+
+}
+

+ 15 - 0
gameplay/src/lua/lua_GamepadButtonMapping.h

@@ -0,0 +1,15 @@
+#ifndef LUA_GAMEPADBUTTONMAPPING_H_
+#define LUA_GAMEPADBUTTONMAPPING_H_
+
+#include "Gamepad.h"
+
+namespace gameplay
+{
+
+// Lua bindings for enum conversion functions for Gamepad::ButtonMapping.
+Gamepad::ButtonMapping lua_enumFromString_GamepadButtonMapping(const char* s);
+const char* lua_stringFromEnum_GamepadButtonMapping(Gamepad::ButtonMapping e);
+
+}
+
+#endif

+ 0 - 33
gameplay/src/lua/lua_GamepadButtonState.cpp

@@ -1,33 +0,0 @@
-#include "Base.h"
-#include "lua_GamepadButtonState.h"
-
-namespace gameplay
-{
-
-static const char* enumStringEmpty = "";
-
-static const char* luaEnumString_GamepadButtonState_BUTTON_PRESSED = "BUTTON_PRESSED";
-static const char* luaEnumString_GamepadButtonState_BUTTON_RELEASED = "BUTTON_RELEASED";
-
-Gamepad::ButtonState lua_enumFromString_GamepadButtonState(const char* s)
-{
-    if (strcmp(s, luaEnumString_GamepadButtonState_BUTTON_PRESSED) == 0)
-        return Gamepad::BUTTON_PRESSED;
-    if (strcmp(s, luaEnumString_GamepadButtonState_BUTTON_RELEASED) == 0)
-        return Gamepad::BUTTON_RELEASED;
-    GP_ERROR("Invalid enumeration value '%s' for enumeration Gamepad::ButtonState.", s);
-    return Gamepad::BUTTON_PRESSED;
-}
-
-const char* lua_stringFromEnum_GamepadButtonState(Gamepad::ButtonState e)
-{
-    if (e == Gamepad::BUTTON_PRESSED)
-        return luaEnumString_GamepadButtonState_BUTTON_PRESSED;
-    if (e == Gamepad::BUTTON_RELEASED)
-        return luaEnumString_GamepadButtonState_BUTTON_RELEASED;
-    GP_ERROR("Invalid enumeration value '%d' for enumeration Gamepad::ButtonState.", e);
-    return enumStringEmpty;
-}
-
-}
-

+ 0 - 15
gameplay/src/lua/lua_GamepadButtonState.h

@@ -1,15 +0,0 @@
-#ifndef LUA_GAMEPADBUTTONSTATE_H_
-#define LUA_GAMEPADBUTTONSTATE_H_
-
-#include "Gamepad.h"
-
-namespace gameplay
-{
-
-// Lua bindings for enum conversion functions for Gamepad::ButtonState.
-Gamepad::ButtonState lua_enumFromString_GamepadButtonState(const char* s);
-const char* lua_stringFromEnum_GamepadButtonState(Gamepad::ButtonState e);
-
-}
-
-#endif

+ 23 - 5
gameplay/src/lua/lua_Global.cpp

@@ -342,12 +342,30 @@ void luaRegister_lua_Global()
         ScriptUtil::registerConstantString("PAUSED", "PAUSED", scopePath);
     }
 
-    // Register enumeration Gamepad::ButtonState.
+    // Register enumeration Gamepad::ButtonMapping.
     {
         std::vector<std::string> scopePath;
         scopePath.push_back("Gamepad");
-        ScriptUtil::registerConstantString("BUTTON_PRESSED", "BUTTON_PRESSED", scopePath);
-        ScriptUtil::registerConstantString("BUTTON_RELEASED", "BUTTON_RELEASED", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_A", "BUTTON_A", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_B", "BUTTON_B", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_C", "BUTTON_C", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_X", "BUTTON_X", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_Y", "BUTTON_Y", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_Z", "BUTTON_Z", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_MENU1", "BUTTON_MENU1", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_MENU2", "BUTTON_MENU2", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_MENU3", "BUTTON_MENU3", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_MENU4", "BUTTON_MENU4", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_L1", "BUTTON_L1", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_L2", "BUTTON_L2", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_L3", "BUTTON_L3", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_R1", "BUTTON_R1", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_R2", "BUTTON_R2", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_R3", "BUTTON_R3", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_UP", "BUTTON_UP", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_DOWN", "BUTTON_DOWN", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_LEFT", "BUTTON_LEFT", scopePath);
+        ScriptUtil::registerConstantString("BUTTON_RIGHT", "BUTTON_RIGHT", scopePath);
     }
 
     // Register enumeration Gamepad::GamepadEvent.
@@ -818,8 +836,8 @@ const char* lua_stringFromEnumGlobal(std::string& enumname, unsigned int value)
         return lua_stringFromEnum_GameClearFlags((Game::ClearFlags)value);
     if (enumname == "Game::State")
         return lua_stringFromEnum_GameState((Game::State)value);
-    if (enumname == "Gamepad::ButtonState")
-        return lua_stringFromEnum_GamepadButtonState((Gamepad::ButtonState)value);
+    if (enumname == "Gamepad::ButtonMapping")
+        return lua_stringFromEnum_GamepadButtonMapping((Gamepad::ButtonMapping)value);
     if (enumname == "Gamepad::GamepadEvent")
         return lua_stringFromEnum_GamepadGamepadEvent((Gamepad::GamepadEvent)value);
     if (enumname == "Gesture::GestureEvent")

+ 1 - 1
gameplay/src/lua/lua_Global.h

@@ -15,7 +15,7 @@
 #include "lua_FontStyle.h"
 #include "lua_GameClearFlags.h"
 #include "lua_GameState.h"
-#include "lua_GamepadButtonState.h"
+#include "lua_GamepadButtonMapping.h"
 #include "lua_GamepadGamepadEvent.h"
 #include "lua_GestureGestureEvent.h"
 #include "lua_ImageFormat.h"

+ 146 - 66
gameplay/src/lua/lua_Joystick.cpp

@@ -31,8 +31,6 @@ void luaRegister_Joystick()
         {"createAnimationFromBy", lua_Joystick_createAnimationFromBy},
         {"createAnimationFromTo", lua_Joystick_createAnimationFromTo},
         {"destroyAnimation", lua_Joystick_destroyAnimation},
-        {"disable", lua_Joystick_disable},
-        {"enable", lua_Joystick_enable},
         {"getAlignment", lua_Joystick_getAlignment},
         {"getAnimation", lua_Joystick_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Joystick_getAnimationPropertyComponentCount},
@@ -55,6 +53,7 @@ void luaRegister_Joystick()
         {"getImageColor", lua_Joystick_getImageColor},
         {"getImageRegion", lua_Joystick_getImageRegion},
         {"getImageUVs", lua_Joystick_getImageUVs},
+        {"getIndex", lua_Joystick_getIndex},
         {"getInnerRegionSize", lua_Joystick_getInnerRegionSize},
         {"getMargin", lua_Joystick_getMargin},
         {"getOpacity", lua_Joystick_getOpacity},
@@ -77,6 +76,7 @@ void luaRegister_Joystick()
         {"isContainer", lua_Joystick_isContainer},
         {"isEnabled", lua_Joystick_isEnabled},
         {"isRelative", lua_Joystick_isRelative},
+        {"isVisible", lua_Joystick_isVisible},
         {"release", lua_Joystick_release},
         {"removeListener", lua_Joystick_removeListener},
         {"removeScriptCallback", lua_Joystick_removeScriptCallback},
@@ -89,6 +89,7 @@ void luaRegister_Joystick()
         {"setConsumeInputEvents", lua_Joystick_setConsumeInputEvents},
         {"setCursorColor", lua_Joystick_setCursorColor},
         {"setCursorRegion", lua_Joystick_setCursorRegion},
+        {"setEnabled", lua_Joystick_setEnabled},
         {"setFocusIndex", lua_Joystick_setFocusIndex},
         {"setFont", lua_Joystick_setFont},
         {"setFontSize", lua_Joystick_setFontSize},
@@ -110,6 +111,7 @@ void luaRegister_Joystick()
         {"setTextAlignment", lua_Joystick_setTextAlignment},
         {"setTextColor", lua_Joystick_setTextColor},
         {"setTextRightToLeft", lua_Joystick_setTextRightToLeft},
+        {"setVisible", lua_Joystick_setVisible},
         {"setWidth", lua_Joystick_setWidth},
         {"setZIndex", lua_Joystick_setZIndex},
         {NULL, NULL}
@@ -683,70 +685,6 @@ int lua_Joystick_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Joystick_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Joystick* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joystick_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Joystick_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Joystick* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Joystick_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Joystick_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -1787,6 +1725,41 @@ int lua_Joystick_getImageUVs(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_getIndex(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Joystick* instance = getInstance(state);
+                unsigned int result = instance->getIndex();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Joystick_getIndex - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_getInnerRegionSize(lua_State* state)
 {
     // Get the number of parameters.
@@ -2791,6 +2764,41 @@ int lua_Joystick_isRelative(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Joystick* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Joystick_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3343,6 +3351,42 @@ int lua_Joystick_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Joystick* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Joystick_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4457,6 +4501,42 @@ int lua_Joystick_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Joystick* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Joystick_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 4 - 2
gameplay/src/lua/lua_Joystick.h

@@ -13,8 +13,6 @@ int lua_Joystick_createAnimation(lua_State* state);
 int lua_Joystick_createAnimationFromBy(lua_State* state);
 int lua_Joystick_createAnimationFromTo(lua_State* state);
 int lua_Joystick_destroyAnimation(lua_State* state);
-int lua_Joystick_disable(lua_State* state);
-int lua_Joystick_enable(lua_State* state);
 int lua_Joystick_getAlignment(lua_State* state);
 int lua_Joystick_getAnimation(lua_State* state);
 int lua_Joystick_getAnimationPropertyComponentCount(lua_State* state);
@@ -37,6 +35,7 @@ int lua_Joystick_getId(lua_State* state);
 int lua_Joystick_getImageColor(lua_State* state);
 int lua_Joystick_getImageRegion(lua_State* state);
 int lua_Joystick_getImageUVs(lua_State* state);
+int lua_Joystick_getIndex(lua_State* state);
 int lua_Joystick_getInnerRegionSize(lua_State* state);
 int lua_Joystick_getMargin(lua_State* state);
 int lua_Joystick_getOpacity(lua_State* state);
@@ -59,6 +58,7 @@ int lua_Joystick_getZIndex(lua_State* state);
 int lua_Joystick_isContainer(lua_State* state);
 int lua_Joystick_isEnabled(lua_State* state);
 int lua_Joystick_isRelative(lua_State* state);
+int lua_Joystick_isVisible(lua_State* state);
 int lua_Joystick_release(lua_State* state);
 int lua_Joystick_removeListener(lua_State* state);
 int lua_Joystick_removeScriptCallback(lua_State* state);
@@ -71,6 +71,7 @@ int lua_Joystick_setBounds(lua_State* state);
 int lua_Joystick_setConsumeInputEvents(lua_State* state);
 int lua_Joystick_setCursorColor(lua_State* state);
 int lua_Joystick_setCursorRegion(lua_State* state);
+int lua_Joystick_setEnabled(lua_State* state);
 int lua_Joystick_setFocusIndex(lua_State* state);
 int lua_Joystick_setFont(lua_State* state);
 int lua_Joystick_setFontSize(lua_State* state);
@@ -92,6 +93,7 @@ int lua_Joystick_setStyle(lua_State* state);
 int lua_Joystick_setTextAlignment(lua_State* state);
 int lua_Joystick_setTextColor(lua_State* state);
 int lua_Joystick_setTextRightToLeft(lua_State* state);
+int lua_Joystick_setVisible(lua_State* state);
 int lua_Joystick_setWidth(lua_State* state);
 int lua_Joystick_setZIndex(lua_State* state);
 int lua_Joystick_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_Label.cpp

@@ -31,8 +31,6 @@ void luaRegister_Label()
         {"createAnimationFromBy", lua_Label_createAnimationFromBy},
         {"createAnimationFromTo", lua_Label_createAnimationFromTo},
         {"destroyAnimation", lua_Label_destroyAnimation},
-        {"disable", lua_Label_disable},
-        {"enable", lua_Label_enable},
         {"getAlignment", lua_Label_getAlignment},
         {"getAnimation", lua_Label_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Label_getAnimationPropertyComponentCount},
@@ -74,6 +72,7 @@ void luaRegister_Label()
         {"getZIndex", lua_Label_getZIndex},
         {"isContainer", lua_Label_isContainer},
         {"isEnabled", lua_Label_isEnabled},
+        {"isVisible", lua_Label_isVisible},
         {"release", lua_Label_release},
         {"removeListener", lua_Label_removeListener},
         {"removeScriptCallback", lua_Label_removeScriptCallback},
@@ -86,6 +85,7 @@ void luaRegister_Label()
         {"setConsumeInputEvents", lua_Label_setConsumeInputEvents},
         {"setCursorColor", lua_Label_setCursorColor},
         {"setCursorRegion", lua_Label_setCursorRegion},
+        {"setEnabled", lua_Label_setEnabled},
         {"setFocusIndex", lua_Label_setFocusIndex},
         {"setFont", lua_Label_setFont},
         {"setFontSize", lua_Label_setFontSize},
@@ -105,6 +105,7 @@ void luaRegister_Label()
         {"setTextAlignment", lua_Label_setTextAlignment},
         {"setTextColor", lua_Label_setTextColor},
         {"setTextRightToLeft", lua_Label_setTextRightToLeft},
+        {"setVisible", lua_Label_setVisible},
         {"setWidth", lua_Label_setWidth},
         {"setZIndex", lua_Label_setZIndex},
         {NULL, NULL}
@@ -678,70 +679,6 @@ int lua_Label_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Label_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Label* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Label_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Label_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Label* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Label_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Label_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2654,6 +2591,41 @@ int lua_Label_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_Label_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Label* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Label_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3206,6 +3178,42 @@ int lua_Label_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Label_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Label* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Label_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4236,6 +4244,42 @@ int lua_Label_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Label_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Label* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Label_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Label.h

@@ -13,8 +13,6 @@ int lua_Label_createAnimation(lua_State* state);
 int lua_Label_createAnimationFromBy(lua_State* state);
 int lua_Label_createAnimationFromTo(lua_State* state);
 int lua_Label_destroyAnimation(lua_State* state);
-int lua_Label_disable(lua_State* state);
-int lua_Label_enable(lua_State* state);
 int lua_Label_getAlignment(lua_State* state);
 int lua_Label_getAnimation(lua_State* state);
 int lua_Label_getAnimationPropertyComponentCount(lua_State* state);
@@ -56,6 +54,7 @@ int lua_Label_getY(lua_State* state);
 int lua_Label_getZIndex(lua_State* state);
 int lua_Label_isContainer(lua_State* state);
 int lua_Label_isEnabled(lua_State* state);
+int lua_Label_isVisible(lua_State* state);
 int lua_Label_release(lua_State* state);
 int lua_Label_removeListener(lua_State* state);
 int lua_Label_removeScriptCallback(lua_State* state);
@@ -68,6 +67,7 @@ int lua_Label_setBounds(lua_State* state);
 int lua_Label_setConsumeInputEvents(lua_State* state);
 int lua_Label_setCursorColor(lua_State* state);
 int lua_Label_setCursorRegion(lua_State* state);
+int lua_Label_setEnabled(lua_State* state);
 int lua_Label_setFocusIndex(lua_State* state);
 int lua_Label_setFont(lua_State* state);
 int lua_Label_setFontSize(lua_State* state);
@@ -87,6 +87,7 @@ int lua_Label_setText(lua_State* state);
 int lua_Label_setTextAlignment(lua_State* state);
 int lua_Label_setTextColor(lua_State* state);
 int lua_Label_setTextRightToLeft(lua_State* state);
+int lua_Label_setVisible(lua_State* state);
 int lua_Label_setWidth(lua_State* state);
 int lua_Label_setZIndex(lua_State* state);
 int lua_Label_static_ANIMATE_OPACITY(lua_State* state);

+ 164 - 0
gameplay/src/lua/lua_Matrix.cpp

@@ -4,6 +4,7 @@
 #include "Base.h"
 #include "MathUtil.h"
 #include "Matrix.h"
+#include "Plane.h"
 #include "Quaternion.h"
 
 namespace gameplay
@@ -48,10 +49,12 @@ void luaRegister_Matrix()
     const luaL_Reg lua_statics[] = 
     {
         {"add", lua_Matrix_static_add},
+        {"createBillboard", lua_Matrix_static_createBillboard},
         {"createLookAt", lua_Matrix_static_createLookAt},
         {"createOrthographic", lua_Matrix_static_createOrthographic},
         {"createOrthographicOffCenter", lua_Matrix_static_createOrthographicOffCenter},
         {"createPerspective", lua_Matrix_static_createPerspective},
+        {"createReflection", lua_Matrix_static_createReflection},
         {"createRotation", lua_Matrix_static_createRotation},
         {"createRotationX", lua_Matrix_static_createRotationX},
         {"createRotationY", lua_Matrix_static_createRotationY},
@@ -1907,6 +1910,117 @@ int lua_Matrix_static_add(lua_State* state)
     return 0;
 }
 
+int lua_Matrix_static_createBillboard(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 4:
+        {
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
+                    (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    // Get parameter 3 off the stack.
+                    bool param3Valid;
+                    ScriptUtil::LuaArray<Vector3> param3 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param3Valid);
+                    if (!param3Valid)
+                        break;
+
+                    // Get parameter 4 off the stack.
+                    bool param4Valid;
+                    ScriptUtil::LuaArray<Matrix> param4 = ScriptUtil::getObjectPointer<Matrix>(4, "Matrix", false, &param4Valid);
+                    if (!param4Valid)
+                        break;
+
+                    Matrix::createBillboard(*param1, *param2, *param3, param4);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Matrix_static_createBillboard - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        case 5:
+        {
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
+                    (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TNIL) &&
+                    (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    // Get parameter 3 off the stack.
+                    bool param3Valid;
+                    ScriptUtil::LuaArray<Vector3> param3 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param3Valid);
+                    if (!param3Valid)
+                        break;
+
+                    // Get parameter 4 off the stack.
+                    bool param4Valid;
+                    ScriptUtil::LuaArray<Vector3> param4 = ScriptUtil::getObjectPointer<Vector3>(4, "Vector3", true, &param4Valid);
+                    if (!param4Valid)
+                        break;
+
+                    // Get parameter 5 off the stack.
+                    bool param5Valid;
+                    ScriptUtil::LuaArray<Matrix> param5 = ScriptUtil::getObjectPointer<Matrix>(5, "Matrix", false, &param5Valid);
+                    if (!param5Valid)
+                        break;
+
+                    Matrix::createBillboard(*param1, *param2, *param3, *param4, param5);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Matrix_static_createBillboard - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4 or 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Matrix_static_createLookAt(lua_State* state)
 {
     // Get the number of parameters.
@@ -2202,6 +2316,56 @@ int lua_Matrix_static_createPerspective(lua_State* state)
     return 0;
 }
 
+int lua_Matrix_static_createReflection(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                bool param1Valid;
+                ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(1, "Plane", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Plane'.");
+                    lua_error(state);
+                }
+
+                // Get parameter 2 off the stack.
+                bool param2Valid;
+                ScriptUtil::LuaArray<Matrix> param2 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Matrix'.");
+                    lua_error(state);
+                }
+
+                Matrix::createReflection(*param1, param2);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Matrix_static_createReflection - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Matrix_static_createRotation(lua_State* state)
 {
     // Get the number of parameters.

+ 2 - 0
gameplay/src/lua/lua_Matrix.h

@@ -33,10 +33,12 @@ int lua_Matrix_set(lua_State* state);
 int lua_Matrix_setIdentity(lua_State* state);
 int lua_Matrix_setZero(lua_State* state);
 int lua_Matrix_static_add(lua_State* state);
+int lua_Matrix_static_createBillboard(lua_State* state);
 int lua_Matrix_static_createLookAt(lua_State* state);
 int lua_Matrix_static_createOrthographic(lua_State* state);
 int lua_Matrix_static_createOrthographicOffCenter(lua_State* state);
 int lua_Matrix_static_createPerspective(lua_State* state);
+int lua_Matrix_static_createReflection(lua_State* state);
 int lua_Matrix_static_createRotation(lua_State* state);
 int lua_Matrix_static_createRotationX(lua_State* state);
 int lua_Matrix_static_createRotationY(lua_State* state);

+ 41 - 478
gameplay/src/lua/lua_Platform.cpp

@@ -25,20 +25,8 @@ void luaRegister_Platform()
         {"getAccelerometerValues", lua_Platform_static_getAccelerometerValues},
         {"getDisplayHeight", lua_Platform_static_getDisplayHeight},
         {"getDisplayWidth", lua_Platform_static_getDisplayWidth},
-        {"getGamepadButtonCount", lua_Platform_static_getGamepadButtonCount},
-        {"getGamepadButtonState", lua_Platform_static_getGamepadButtonState},
-        {"getGamepadId", lua_Platform_static_getGamepadId},
-        {"getGamepadJoystickAxisValues", lua_Platform_static_getGamepadJoystickAxisValues},
-        {"getGamepadJoystickAxisX", lua_Platform_static_getGamepadJoystickAxisX},
-        {"getGamepadJoystickAxisY", lua_Platform_static_getGamepadJoystickAxisY},
-        {"getGamepadJoystickCount", lua_Platform_static_getGamepadJoystickCount},
-        {"getGamepadTriggerCount", lua_Platform_static_getGamepadTriggerCount},
-        {"getGamepadTriggerValue", lua_Platform_static_getGamepadTriggerValue},
-        {"getGamepadsConnected", lua_Platform_static_getGamepadsConnected},
         {"hasMouse", lua_Platform_static_hasMouse},
         {"isCursorVisible", lua_Platform_static_isCursorVisible},
-        {"isGamepadConnected", lua_Platform_static_isGamepadConnected},
-        {"isGamepadJoystickActive", lua_Platform_static_isGamepadJoystickActive},
         {"isGestureRegistered", lua_Platform_static_isGestureRegistered},
         {"isGestureSupported", lua_Platform_static_isGestureSupported},
         {"isMouseCaptured", lua_Platform_static_isMouseCaptured},
@@ -47,6 +35,7 @@ void luaRegister_Platform()
         {"keyEventInternal", lua_Platform_static_keyEventInternal},
         {"launchURL", lua_Platform_static_launchURL},
         {"mouseEventInternal", lua_Platform_static_mouseEventInternal},
+        {"pollGamepadState", lua_Platform_static_pollGamepadState},
         {"registerGesture", lua_Platform_static_registerGesture},
         {"setAbsoluteTime", lua_Platform_static_setAbsoluteTime},
         {"setCursorVisible", lua_Platform_static_setCursorVisible},
@@ -329,394 +318,6 @@ int lua_Platform_static_getDisplayWidth(lua_State* state)
     return 0;
 }
 
-int lua_Platform_static_getGamepadButtonCount(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                unsigned int result = Platform::getGamepadButtonCount(param1);
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadButtonCount - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadButtonState(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                bool result = Platform::getGamepadButtonState(param1, param2);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadButtonState - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadId(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                const char* result = Platform::getGamepadId(param1);
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadId - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadJoystickAxisValues(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 3:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                // Get parameter 3 off the stack.
-                bool param3Valid;
-                ScriptUtil::LuaArray<Vector2> param3 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param3Valid);
-                if (!param3Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 3 to type 'Vector2'.");
-                    lua_error(state);
-                }
-
-                Platform::getGamepadJoystickAxisValues(param1, param2, param3);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisValues - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadJoystickAxisX(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                float result = Platform::getGamepadJoystickAxisX(param1, param2);
-
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisX - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadJoystickAxisY(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                float result = Platform::getGamepadJoystickAxisY(param1, param2);
-
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisY - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                unsigned int result = Platform::getGamepadJoystickCount(param1);
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadJoystickCount - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadTriggerCount(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                unsigned int result = Platform::getGamepadTriggerCount(param1);
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadTriggerCount - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadTriggerValue(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                float result = Platform::getGamepadTriggerValue(param1, param2);
-
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getGamepadTriggerValue - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_getGamepadsConnected(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 0:
-        {
-            unsigned int result = Platform::getGamepadsConnected();
-
-            // Push the return value onto the stack.
-            lua_pushunsigned(state, result);
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Platform_static_hasMouse(lua_State* state)
 {
     // Get the number of parameters.
@@ -773,84 +374,6 @@ int lua_Platform_static_isCursorVisible(lua_State* state)
     return 0;
 }
 
-int lua_Platform_static_isGamepadConnected(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                bool result = Platform::isGamepadConnected(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_isGamepadConnected - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_isGamepadJoystickActive(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                bool result = Platform::isGamepadJoystickActive(param1, param2);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_isGamepadJoystickActive - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Platform_static_isGestureRegistered(lua_State* state)
 {
     // Get the number of parameters.
@@ -1133,6 +656,46 @@ int lua_Platform_static_mouseEventInternal(lua_State* state)
     return 0;
 }
 
+int lua_Platform_static_pollGamepadState(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                bool param1Valid;
+                ScriptUtil::LuaArray<Gamepad> param1 = ScriptUtil::getObjectPointer<Gamepad>(1, "Gamepad", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Gamepad'.");
+                    lua_error(state);
+                }
+
+                Platform::pollGamepadState(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Platform_static_pollGamepadState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Platform_static_registerGesture(lua_State* state)
 {
     // Get the number of parameters.

+ 1 - 12
gameplay/src/lua/lua_Platform.h

@@ -13,20 +13,8 @@ int lua_Platform_static_getAbsoluteTime(lua_State* state);
 int lua_Platform_static_getAccelerometerValues(lua_State* state);
 int lua_Platform_static_getDisplayHeight(lua_State* state);
 int lua_Platform_static_getDisplayWidth(lua_State* state);
-int lua_Platform_static_getGamepadButtonCount(lua_State* state);
-int lua_Platform_static_getGamepadButtonState(lua_State* state);
-int lua_Platform_static_getGamepadId(lua_State* state);
-int lua_Platform_static_getGamepadJoystickAxisValues(lua_State* state);
-int lua_Platform_static_getGamepadJoystickAxisX(lua_State* state);
-int lua_Platform_static_getGamepadJoystickAxisY(lua_State* state);
-int lua_Platform_static_getGamepadJoystickCount(lua_State* state);
-int lua_Platform_static_getGamepadTriggerCount(lua_State* state);
-int lua_Platform_static_getGamepadTriggerValue(lua_State* state);
-int lua_Platform_static_getGamepadsConnected(lua_State* state);
 int lua_Platform_static_hasMouse(lua_State* state);
 int lua_Platform_static_isCursorVisible(lua_State* state);
-int lua_Platform_static_isGamepadConnected(lua_State* state);
-int lua_Platform_static_isGamepadJoystickActive(lua_State* state);
 int lua_Platform_static_isGestureRegistered(lua_State* state);
 int lua_Platform_static_isGestureSupported(lua_State* state);
 int lua_Platform_static_isMouseCaptured(lua_State* state);
@@ -35,6 +23,7 @@ int lua_Platform_static_isVsync(lua_State* state);
 int lua_Platform_static_keyEventInternal(lua_State* state);
 int lua_Platform_static_launchURL(lua_State* state);
 int lua_Platform_static_mouseEventInternal(lua_State* state);
+int lua_Platform_static_pollGamepadState(lua_State* state);
 int lua_Platform_static_registerGesture(lua_State* state);
 int lua_Platform_static_setAbsoluteTime(lua_State* state);
 int lua_Platform_static_setCursorVisible(lua_State* state);

+ 111 - 66
gameplay/src/lua/lua_RadioButton.cpp

@@ -7,6 +7,7 @@
 #include "Button.h"
 #include "Control.h"
 #include "Game.h"
+#include "Gamepad.h"
 #include "Label.h"
 #include "Node.h"
 #include "RadioButton.h"
@@ -33,8 +34,6 @@ void luaRegister_RadioButton()
         {"createAnimationFromBy", lua_RadioButton_createAnimationFromBy},
         {"createAnimationFromTo", lua_RadioButton_createAnimationFromTo},
         {"destroyAnimation", lua_RadioButton_destroyAnimation},
-        {"disable", lua_RadioButton_disable},
-        {"enable", lua_RadioButton_enable},
         {"getAlignment", lua_RadioButton_getAlignment},
         {"getAnimation", lua_RadioButton_getAnimation},
         {"getAnimationPropertyComponentCount", lua_RadioButton_getAnimationPropertyComponentCount},
@@ -79,6 +78,7 @@ void luaRegister_RadioButton()
         {"isContainer", lua_RadioButton_isContainer},
         {"isEnabled", lua_RadioButton_isEnabled},
         {"isSelected", lua_RadioButton_isSelected},
+        {"isVisible", lua_RadioButton_isVisible},
         {"release", lua_RadioButton_release},
         {"removeListener", lua_RadioButton_removeListener},
         {"removeScriptCallback", lua_RadioButton_removeScriptCallback},
@@ -91,6 +91,7 @@ void luaRegister_RadioButton()
         {"setConsumeInputEvents", lua_RadioButton_setConsumeInputEvents},
         {"setCursorColor", lua_RadioButton_setCursorColor},
         {"setCursorRegion", lua_RadioButton_setCursorRegion},
+        {"setEnabled", lua_RadioButton_setEnabled},
         {"setFocusIndex", lua_RadioButton_setFocusIndex},
         {"setFont", lua_RadioButton_setFont},
         {"setFontSize", lua_RadioButton_setFontSize},
@@ -113,6 +114,7 @@ void luaRegister_RadioButton()
         {"setTextAlignment", lua_RadioButton_setTextAlignment},
         {"setTextColor", lua_RadioButton_setTextColor},
         {"setTextRightToLeft", lua_RadioButton_setTextRightToLeft},
+        {"setVisible", lua_RadioButton_setVisible},
         {"setWidth", lua_RadioButton_setWidth},
         {"setZIndex", lua_RadioButton_setZIndex},
         {NULL, NULL}
@@ -686,70 +688,6 @@ int lua_RadioButton_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_RadioButton_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                RadioButton* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_RadioButton_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                RadioButton* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_RadioButton_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2776,6 +2714,41 @@ int lua_RadioButton_isSelected(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                RadioButton* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_RadioButton_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3328,6 +3301,42 @@ int lua_RadioButton_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                RadioButton* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_RadioButton_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4470,6 +4479,42 @@ int lua_RadioButton_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                RadioButton* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_RadioButton_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_RadioButton.h

@@ -13,8 +13,6 @@ int lua_RadioButton_createAnimation(lua_State* state);
 int lua_RadioButton_createAnimationFromBy(lua_State* state);
 int lua_RadioButton_createAnimationFromTo(lua_State* state);
 int lua_RadioButton_destroyAnimation(lua_State* state);
-int lua_RadioButton_disable(lua_State* state);
-int lua_RadioButton_enable(lua_State* state);
 int lua_RadioButton_getAlignment(lua_State* state);
 int lua_RadioButton_getAnimation(lua_State* state);
 int lua_RadioButton_getAnimationPropertyComponentCount(lua_State* state);
@@ -59,6 +57,7 @@ int lua_RadioButton_getZIndex(lua_State* state);
 int lua_RadioButton_isContainer(lua_State* state);
 int lua_RadioButton_isEnabled(lua_State* state);
 int lua_RadioButton_isSelected(lua_State* state);
+int lua_RadioButton_isVisible(lua_State* state);
 int lua_RadioButton_release(lua_State* state);
 int lua_RadioButton_removeListener(lua_State* state);
 int lua_RadioButton_removeScriptCallback(lua_State* state);
@@ -71,6 +70,7 @@ int lua_RadioButton_setBounds(lua_State* state);
 int lua_RadioButton_setConsumeInputEvents(lua_State* state);
 int lua_RadioButton_setCursorColor(lua_State* state);
 int lua_RadioButton_setCursorRegion(lua_State* state);
+int lua_RadioButton_setEnabled(lua_State* state);
 int lua_RadioButton_setFocusIndex(lua_State* state);
 int lua_RadioButton_setFont(lua_State* state);
 int lua_RadioButton_setFontSize(lua_State* state);
@@ -93,6 +93,7 @@ int lua_RadioButton_setText(lua_State* state);
 int lua_RadioButton_setTextAlignment(lua_State* state);
 int lua_RadioButton_setTextColor(lua_State* state);
 int lua_RadioButton_setTextRightToLeft(lua_State* state);
+int lua_RadioButton_setVisible(lua_State* state);
 int lua_RadioButton_setWidth(lua_State* state);
 int lua_RadioButton_setZIndex(lua_State* state);
 int lua_RadioButton_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_Slider.cpp

@@ -32,8 +32,6 @@ void luaRegister_Slider()
         {"createAnimationFromBy", lua_Slider_createAnimationFromBy},
         {"createAnimationFromTo", lua_Slider_createAnimationFromTo},
         {"destroyAnimation", lua_Slider_destroyAnimation},
-        {"disable", lua_Slider_disable},
-        {"enable", lua_Slider_enable},
         {"getAlignment", lua_Slider_getAlignment},
         {"getAnimation", lua_Slider_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Slider_getAnimationPropertyComponentCount},
@@ -79,6 +77,7 @@ void luaRegister_Slider()
         {"getZIndex", lua_Slider_getZIndex},
         {"isContainer", lua_Slider_isContainer},
         {"isEnabled", lua_Slider_isEnabled},
+        {"isVisible", lua_Slider_isVisible},
         {"release", lua_Slider_release},
         {"removeListener", lua_Slider_removeListener},
         {"removeScriptCallback", lua_Slider_removeScriptCallback},
@@ -91,6 +90,7 @@ void luaRegister_Slider()
         {"setConsumeInputEvents", lua_Slider_setConsumeInputEvents},
         {"setCursorColor", lua_Slider_setCursorColor},
         {"setCursorRegion", lua_Slider_setCursorRegion},
+        {"setEnabled", lua_Slider_setEnabled},
         {"setFocusIndex", lua_Slider_setFocusIndex},
         {"setFont", lua_Slider_setFont},
         {"setFontSize", lua_Slider_setFontSize},
@@ -114,6 +114,7 @@ void luaRegister_Slider()
         {"setTextColor", lua_Slider_setTextColor},
         {"setTextRightToLeft", lua_Slider_setTextRightToLeft},
         {"setValue", lua_Slider_setValue},
+        {"setVisible", lua_Slider_setVisible},
         {"setWidth", lua_Slider_setWidth},
         {"setZIndex", lua_Slider_setZIndex},
         {NULL, NULL}
@@ -687,70 +688,6 @@ int lua_Slider_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_Slider_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Slider* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Slider_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Slider_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Slider* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Slider_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Slider_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2803,6 +2740,41 @@ int lua_Slider_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_Slider_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Slider* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Slider_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3355,6 +3327,42 @@ int lua_Slider_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_Slider_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Slider* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Slider_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4529,6 +4537,42 @@ int lua_Slider_setValue(lua_State* state)
     return 0;
 }
 
+int lua_Slider_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                Slider* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_Slider_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_Slider.h

@@ -13,8 +13,6 @@ int lua_Slider_createAnimation(lua_State* state);
 int lua_Slider_createAnimationFromBy(lua_State* state);
 int lua_Slider_createAnimationFromTo(lua_State* state);
 int lua_Slider_destroyAnimation(lua_State* state);
-int lua_Slider_disable(lua_State* state);
-int lua_Slider_enable(lua_State* state);
 int lua_Slider_getAlignment(lua_State* state);
 int lua_Slider_getAnimation(lua_State* state);
 int lua_Slider_getAnimationPropertyComponentCount(lua_State* state);
@@ -60,6 +58,7 @@ int lua_Slider_getY(lua_State* state);
 int lua_Slider_getZIndex(lua_State* state);
 int lua_Slider_isContainer(lua_State* state);
 int lua_Slider_isEnabled(lua_State* state);
+int lua_Slider_isVisible(lua_State* state);
 int lua_Slider_release(lua_State* state);
 int lua_Slider_removeListener(lua_State* state);
 int lua_Slider_removeScriptCallback(lua_State* state);
@@ -72,6 +71,7 @@ int lua_Slider_setBounds(lua_State* state);
 int lua_Slider_setConsumeInputEvents(lua_State* state);
 int lua_Slider_setCursorColor(lua_State* state);
 int lua_Slider_setCursorRegion(lua_State* state);
+int lua_Slider_setEnabled(lua_State* state);
 int lua_Slider_setFocusIndex(lua_State* state);
 int lua_Slider_setFont(lua_State* state);
 int lua_Slider_setFontSize(lua_State* state);
@@ -95,6 +95,7 @@ int lua_Slider_setTextAlignment(lua_State* state);
 int lua_Slider_setTextColor(lua_State* state);
 int lua_Slider_setTextRightToLeft(lua_State* state);
 int lua_Slider_setValue(lua_State* state);
+int lua_Slider_setVisible(lua_State* state);
 int lua_Slider_setWidth(lua_State* state);
 int lua_Slider_setZIndex(lua_State* state);
 int lua_Slider_static_ANIMATE_OPACITY(lua_State* state);

+ 110 - 66
gameplay/src/lua/lua_TextBox.cpp

@@ -32,8 +32,6 @@ void luaRegister_TextBox()
         {"createAnimationFromBy", lua_TextBox_createAnimationFromBy},
         {"createAnimationFromTo", lua_TextBox_createAnimationFromTo},
         {"destroyAnimation", lua_TextBox_destroyAnimation},
-        {"disable", lua_TextBox_disable},
-        {"enable", lua_TextBox_enable},
         {"getAlignment", lua_TextBox_getAlignment},
         {"getAnimation", lua_TextBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_TextBox_getAnimationPropertyComponentCount},
@@ -76,6 +74,7 @@ void luaRegister_TextBox()
         {"getZIndex", lua_TextBox_getZIndex},
         {"isContainer", lua_TextBox_isContainer},
         {"isEnabled", lua_TextBox_isEnabled},
+        {"isVisible", lua_TextBox_isVisible},
         {"release", lua_TextBox_release},
         {"removeListener", lua_TextBox_removeListener},
         {"removeScriptCallback", lua_TextBox_removeScriptCallback},
@@ -88,6 +87,7 @@ void luaRegister_TextBox()
         {"setConsumeInputEvents", lua_TextBox_setConsumeInputEvents},
         {"setCursorColor", lua_TextBox_setCursorColor},
         {"setCursorRegion", lua_TextBox_setCursorRegion},
+        {"setEnabled", lua_TextBox_setEnabled},
         {"setFocusIndex", lua_TextBox_setFocusIndex},
         {"setFont", lua_TextBox_setFont},
         {"setFontSize", lua_TextBox_setFontSize},
@@ -107,6 +107,7 @@ void luaRegister_TextBox()
         {"setTextAlignment", lua_TextBox_setTextAlignment},
         {"setTextColor", lua_TextBox_setTextColor},
         {"setTextRightToLeft", lua_TextBox_setTextRightToLeft},
+        {"setVisible", lua_TextBox_setVisible},
         {"setWidth", lua_TextBox_setWidth},
         {"setZIndex", lua_TextBox_setZIndex},
         {NULL, NULL}
@@ -680,70 +681,6 @@ int lua_TextBox_destroyAnimation(lua_State* state)
     return 0;
 }
 
-int lua_TextBox_disable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                TextBox* instance = getInstance(state);
-                instance->disable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_TextBox_disable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_TextBox_enable(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                TextBox* instance = getInstance(state);
-                instance->enable();
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_TextBox_enable - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_TextBox_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -2691,6 +2628,41 @@ int lua_TextBox_isEnabled(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_isVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                TextBox* instance = getInstance(state);
+                bool result = instance->isVisible();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_TextBox_isVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_release(lua_State* state)
 {
     // Get the number of parameters.
@@ -3243,6 +3215,42 @@ int lua_TextBox_setCursorRegion(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                TextBox* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_TextBox_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_setFocusIndex(lua_State* state)
 {
     // Get the number of parameters.
@@ -4273,6 +4281,42 @@ int lua_TextBox_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_setVisible(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                TextBox* instance = getInstance(state);
+                instance->setVisible(param1);
+                
+                return 0;
+            }
+
+            lua_pushstring(state, "lua_TextBox_setVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_setWidth(lua_State* state)
 {
     // Get the number of parameters.

+ 3 - 2
gameplay/src/lua/lua_TextBox.h

@@ -13,8 +13,6 @@ int lua_TextBox_createAnimation(lua_State* state);
 int lua_TextBox_createAnimationFromBy(lua_State* state);
 int lua_TextBox_createAnimationFromTo(lua_State* state);
 int lua_TextBox_destroyAnimation(lua_State* state);
-int lua_TextBox_disable(lua_State* state);
-int lua_TextBox_enable(lua_State* state);
 int lua_TextBox_getAlignment(lua_State* state);
 int lua_TextBox_getAnimation(lua_State* state);
 int lua_TextBox_getAnimationPropertyComponentCount(lua_State* state);
@@ -57,6 +55,7 @@ int lua_TextBox_getY(lua_State* state);
 int lua_TextBox_getZIndex(lua_State* state);
 int lua_TextBox_isContainer(lua_State* state);
 int lua_TextBox_isEnabled(lua_State* state);
+int lua_TextBox_isVisible(lua_State* state);
 int lua_TextBox_release(lua_State* state);
 int lua_TextBox_removeListener(lua_State* state);
 int lua_TextBox_removeScriptCallback(lua_State* state);
@@ -69,6 +68,7 @@ int lua_TextBox_setBounds(lua_State* state);
 int lua_TextBox_setConsumeInputEvents(lua_State* state);
 int lua_TextBox_setCursorColor(lua_State* state);
 int lua_TextBox_setCursorRegion(lua_State* state);
+int lua_TextBox_setEnabled(lua_State* state);
 int lua_TextBox_setFocusIndex(lua_State* state);
 int lua_TextBox_setFont(lua_State* state);
 int lua_TextBox_setFontSize(lua_State* state);
@@ -88,6 +88,7 @@ int lua_TextBox_setText(lua_State* state);
 int lua_TextBox_setTextAlignment(lua_State* state);
 int lua_TextBox_setTextColor(lua_State* state);
 int lua_TextBox_setTextRightToLeft(lua_State* state);
+int lua_TextBox_setVisible(lua_State* state);
 int lua_TextBox_setWidth(lua_State* state);
 int lua_TextBox_setZIndex(lua_State* state);
 int lua_TextBox_static_ANIMATE_OPACITY(lua_State* state);