Browse Source

Merge pull request #1420 from sgrenier/next

UI theme and layout changes
Steve Grenier 12 years ago
parent
commit
8bb2349faa
91 changed files with 2007 additions and 3410 deletions
  1. 13 13
      gameplay.sln
  2. 4 0
      gameplay/gameplay.vcxproj
  3. 11 0
      gameplay/gameplay.vcxproj.filters
  4. BIN
      gameplay/res/design/default-theme.psd
  5. BIN
      gameplay/res/ui/default-theme.png
  6. 474 0
      gameplay/res/ui/default.theme
  7. 2 16
      gameplay/src/AbsoluteLayout.cpp
  8. 1 2
      gameplay/src/AbsoluteLayout.h
  9. 29 55
      gameplay/src/CheckBox.cpp
  10. 12 26
      gameplay/src/CheckBox.h
  11. 184 138
      gameplay/src/Container.cpp
  12. 29 13
      gameplay/src/Container.h
  13. 318 184
      gameplay/src/Control.cpp
  14. 140 82
      gameplay/src/Control.h
  15. 1 4
      gameplay/src/FlowLayout.cpp
  16. 1 2
      gameplay/src/FlowLayout.h
  17. 16 16
      gameplay/src/Font.cpp
  18. 54 163
      gameplay/src/Form.cpp
  19. 1 15
      gameplay/src/Form.h
  20. 10 12
      gameplay/src/ImageControl.cpp
  21. 2 2
      gameplay/src/ImageControl.h
  22. 0 3
      gameplay/src/JoystickControl.cpp
  23. 39 18
      gameplay/src/Label.cpp
  24. 17 6
      gameplay/src/Label.h
  25. 0 64
      gameplay/src/Layout.cpp
  26. 2 10
      gameplay/src/Layout.h
  27. 1 1
      gameplay/src/ParticleEmitter.cpp
  28. 30 57
      gameplay/src/RadioButton.cpp
  29. 14 28
      gameplay/src/RadioButton.h
  30. 149 123
      gameplay/src/Slider.cpp
  31. 14 6
      gameplay/src/Slider.h
  32. 2 12
      gameplay/src/TextBox.cpp
  33. 2 6
      gameplay/src/TextBox.h
  34. 1 1
      gameplay/src/Theme.cpp
  35. 5 0
      gameplay/src/Theme.h
  36. 1 4
      gameplay/src/VerticalLayout.cpp
  37. 1 2
      gameplay/src/VerticalLayout.h
  38. 16 125
      gameplay/src/lua/lua_Button.cpp
  39. 2 4
      gameplay/src/lua/lua_Button.h
  40. 16 211
      gameplay/src/lua/lua_CheckBox.cpp
  41. 2 6
      gameplay/src/lua/lua_CheckBox.h
  42. 16 125
      gameplay/src/lua/lua_Container.cpp
  43. 2 4
      gameplay/src/lua/lua_Container.h
  44. 16 125
      gameplay/src/lua/lua_Control.cpp
  45. 2 4
      gameplay/src/lua/lua_Control.h
  46. 15 10
      gameplay/src/lua/lua_ControlAutoSize.cpp
  47. 16 125
      gameplay/src/lua/lua_Form.cpp
  48. 2 4
      gameplay/src/lua/lua_Form.h
  49. 3 2
      gameplay/src/lua/lua_Global.cpp
  50. 16 125
      gameplay/src/lua/lua_ImageControl.cpp
  51. 2 4
      gameplay/src/lua/lua_ImageControl.h
  52. 16 125
      gameplay/src/lua/lua_JoystickControl.cpp
  53. 2 4
      gameplay/src/lua/lua_JoystickControl.h
  54. 16 125
      gameplay/src/lua/lua_Label.cpp
  55. 2 4
      gameplay/src/lua/lua_Label.h
  56. 16 211
      gameplay/src/lua/lua_RadioButton.cpp
  57. 2 6
      gameplay/src/lua/lua_RadioButton.h
  58. 16 125
      gameplay/src/lua/lua_Slider.cpp
  59. 2 4
      gameplay/src/lua/lua_Slider.h
  60. 16 125
      gameplay/src/lua/lua_TextBox.cpp
  61. 2 4
      gameplay/src/lua/lua_TextBox.h
  62. 1 1
      samples/browser/game.config
  63. 0 414
      samples/browser/res/common/default.theme
  64. 28 34
      samples/browser/res/common/forms/formBasicControls.form
  65. 1 1
      samples/browser/res/common/forms/formFlowLayout.form
  66. 1 2
      samples/browser/res/common/forms/formScrolling.form
  67. 0 5
      samples/browser/res/common/forms/formSelect.form
  68. 1 2
      samples/browser/res/common/forms/formVerticalLayout.form
  69. 2 5
      samples/browser/res/common/forms/formZOrder.form
  70. 1 2
      samples/browser/res/common/gamepad.form
  71. 1 8
      samples/browser/res/common/inputs.form
  72. 17 40
      samples/browser/res/common/light.form
  73. 1 6
      samples/browser/res/common/physics.form
  74. 13 24
      samples/browser/res/common/terrain/terrain.form
  75. 25 35
      samples/browser/res/common/text.form
  76. BIN
      samples/browser/res/png/default-theme.png
  77. 2 2
      samples/browser/src/Audio3DSample.cpp
  78. 1 1
      samples/browser/src/GamepadSample.cpp
  79. 1 1
      samples/browser/src/LightSample.cpp
  80. 3 5
      samples/browser/src/SamplesGame.cpp
  81. 2 3
      samples/character/res/common/gamepad.form
  82. 6 1
      samples/particles/game.config
  83. 61 89
      samples/particles/res/editor.form
  84. 7 6
      samples/particles/src/ParticlesGame.cpp
  85. 5 0
      samples/racer/game.atc.config
  86. 5 0
      samples/racer/game.dxt.config
  87. 5 0
      samples/racer/game.png.config
  88. 5 0
      samples/racer/game.pvr.config
  89. 4 4
      samples/racer/res/common/gamepad.form
  90. 9 22
      samples/racer/res/common/menu.form
  91. 3 6
      samples/racer/res/common/overlay.form

+ 13 - 13
gameplay.sln

@@ -1,6 +1,6 @@
 
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
+# Visual Studio Express 2013 for Windows Desktop
 VisualStudioVersion = 12.0.21005.1
 VisualStudioVersion = 12.0.21005.1
 MinimumVisualStudioVersion = 10.0.40219.1
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-mesh", "samples\mesh\sample-mesh.vcxproj", "{D672DC66-3CE0-4878-B0D2-813CA731012F}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-mesh", "samples\mesh\sample-mesh.vcxproj", "{D672DC66-3CE0-4878-B0D2-813CA731012F}"
@@ -50,6 +50,18 @@ Global
 		Release|x64 = Release|x64
 		Release|x64 = Release|x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.ActiveCfg = Debug|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.Build.0 = Debug|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.Build.0 = DebugMem|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.ActiveCfg = Release|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.Build.0 = Release|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.Build.0 = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.Build.0 = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.ActiveCfg = Debug|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.ActiveCfg = Debug|x64
@@ -74,18 +86,6 @@ Global
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.Build.0 = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.Build.0 = Release|Win32
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.ActiveCfg = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.ActiveCfg = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.Build.0 = Release|x64
 		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.Build.0 = Release|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.ActiveCfg = Debug|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.Build.0 = Debug|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.ActiveCfg = DebugMem|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.Build.0 = DebugMem|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.ActiveCfg = Release|x64
-		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.Build.0 = Release|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.Build.0 = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.Build.0 = Debug|Win32
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.ActiveCfg = Debug|x64
 		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.ActiveCfg = Debug|x64

+ 4 - 0
gameplay/gameplay.vcxproj

@@ -620,6 +620,7 @@
     <None Include="res\shaders\terrain.vert" />
     <None Include="res\shaders\terrain.vert" />
     <None Include="res\shaders\textured.frag" />
     <None Include="res\shaders\textured.frag" />
     <None Include="res\shaders\textured.vert" />
     <None Include="res\shaders\textured.vert" />
+    <None Include="res\ui\default.theme" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
     <None Include="src\BoundingSphere.inl" />
     <None Include="src\Game.inl" />
     <None Include="src\Game.inl" />
@@ -643,6 +644,9 @@
     <None Include="src\PhysicsRigidBody.inl" />
     <None Include="src\PhysicsRigidBody.inl" />
     <None Include="src\PhysicsSpringConstraint.inl" />
     <None Include="src\PhysicsSpringConstraint.inl" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\ui\default-theme.png" />
+  </ItemGroup>
   <PropertyGroup Label="Globals">
   <PropertyGroup Label="Globals">
     <ProjectGuid>{1032BA4B-57EB-4348-9E03-29DD63E80E4A}</ProjectGuid>
     <ProjectGuid>{1032BA4B-57EB-4348-9E03-29DD63E80E4A}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
     <Keyword>Win32Proj</Keyword>

+ 11 - 0
gameplay/gameplay.vcxproj.filters

@@ -16,6 +16,9 @@
     <Filter Include="res\materials">
     <Filter Include="res\materials">
       <UniqueIdentifier>{b5f23c37-1023-4796-ba7b-b45aa30d67b6}</UniqueIdentifier>
       <UniqueIdentifier>{b5f23c37-1023-4796-ba7b-b45aa30d67b6}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="res\ui">
+      <UniqueIdentifier>{eb377577-593a-469f-9361-b6950a99e431}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\Plane.cpp">
     <ClCompile Include="src\Plane.cpp">
@@ -1816,6 +1819,9 @@
     <None Include="res\materials\terrain.material">
     <None Include="res\materials\terrain.material">
       <Filter>res\materials</Filter>
       <Filter>res\materials</Filter>
     </None>
     </None>
+    <None Include="res\ui\default.theme">
+      <Filter>res\ui</Filter>
+    </None>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="src\PhysicsFixedConstraint.inl">
     <None Include="src\PhysicsFixedConstraint.inl">
@@ -1852,4 +1858,9 @@
       <Filter>src</Filter>
       <Filter>src</Filter>
     </None>
     </None>
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\ui\default-theme.png">
+      <Filter>res\ui</Filter>
+    </Image>
+  </ItemGroup>
 </Project>
 </Project>

BIN
gameplay/res/design/default-theme.psd


BIN
gameplay/res/ui/default-theme.png


+ 474 - 0
gameplay/res/ui/default.theme

@@ -0,0 +1,474 @@
+theme mainMenu
+{
+    texture = default-theme.png
+
+    /////////////////////////////////////////////////////////////////////
+    //                    Global theme variables                       //
+    /////////////////////////////////////////////////////////////////////
+
+    ${normalColor} = #ffffffff
+    ${hoverColor} = #eeeeeeff
+    ${activeColor} = #aaaaaaff
+    ${focusColor} = ${normalColor}
+    ${textColor} = #ffffffff
+    ${font} = arial.gpb
+    ${fontSize} = 16
+    ${disabledOpacity} = 0.5
+
+    /////////////////////////////////////////////////////////////////////
+    //                        Image lists                              //
+    /////////////////////////////////////////////////////////////////////
+
+    imageList normalImages
+    {
+        color = ${normalColor}
+
+        image unchecked
+        {
+            region = 83, 3, 34, 34
+        }
+
+        image checked
+        {
+            region = 83, 37, 34, 34
+        }
+
+        image unselected
+        {
+            region = 120, 3, 34, 34
+        }
+
+        image selected
+        {
+            region = 120, 37, 34, 34
+        }
+
+        image minCap
+        {
+            region = 3, 41, 8, 17
+        }
+
+        image track
+        {
+            region = 11, 41, 62, 17
+        }
+
+        image maxCap
+        {
+            region = 73, 41, 8, 17
+        }
+
+        image marker
+        {
+            region = 6, 59, 15, 27
+        }
+
+        image textCaret
+        {
+            region = 6, 92, 7, 22
+        }
+
+        image scrollBarTopCap
+        {
+            region = 65, 59, 13, 6
+        }
+
+        image verticalScrollBar
+        {
+            region = 65, 65, 13, 2
+        }
+
+        image scrollBarBottomCap
+        {
+            region = 65, 88, 13, 6
+        }
+
+        image scrollBarLeftCap
+        {
+            region = 25, 59, 6, 13
+        }
+
+        image horizontalScrollBar
+        {
+            region = 32, 59, 2, 13
+        }
+
+        image scrollBarRightCap
+        {
+            region = 55, 59, 6, 13
+        }
+    }
+
+    imageList hoverImages : normalImages
+    {
+        color = ${hoverColor}
+
+        image textCaret
+        {
+            color = ${normalColor}
+            region = 6, 92, 7, 22
+        }
+    }
+
+    imageList activeImages : normalImages
+    {
+        color = ${activeColor}
+
+        image unchecked
+        {
+            region = 83, 37, 34, 34
+        }
+
+        image checked
+        {
+            region = 83, 37, 34, 34
+        }
+
+        image selected
+        {
+            region = 120, 37, 34, 34
+        }
+
+        image unselected
+        {
+            region = 120, 37, 34, 34
+        }
+
+        image textCaret
+        {
+            color = ${normalColor}
+            region = 6, 92, 7, 22
+        }
+    }
+
+    /////////////////////////////////////////////////////////////////////
+    //                     Skin definitions                            //
+    /////////////////////////////////////////////////////////////////////
+
+    skin FormSkin
+    {
+        border
+        {
+            left = 8
+            right = 8
+            top = 8
+            bottom = 8
+        }
+
+        region = 4, 4, 32, 32
+        color = ${normalColor}
+    }
+
+    skin ButtonSkin
+    {
+        border
+        {
+            left = 12
+            right = 12
+            top = 12
+            bottom = 12
+        }
+
+        region = 42, 3, 34, 34
+        color = ${normalColor}
+    }
+
+    skin ButtonSkinHover : ButtonSkin
+    {
+        color = ${hoverColor}
+    }
+
+    skin ButtonSkinActive : ButtonSkin
+    {
+        color = ${activeColor}
+    }
+
+    skin ButtonSkinFocus : ButtonSkin
+    {
+        color = ${focusColor}
+    }
+
+    skin TextBoxSkin
+    {
+        border
+        {
+            left = 8
+            right = 8
+            top = 8
+            bottom = 8
+        }
+
+        region = 159, 3, 34, 34
+        color = ${normalColor}
+    }
+
+    skin TextBoxSkinHover : TextBoxSkin
+    {
+        color = ${hoverColor}
+    }
+
+    skin TextBoxSkinActive : TextBoxSkin
+    {
+        color = ${normalColor}
+    }
+
+    skin PanelSkin
+    {
+        border
+        {
+            left = 10
+            right = 10
+            top = 10
+            bottom = 10
+        }
+
+        region = 83, 3, 34, 34
+        color = ${normalColor}
+    }
+
+    style Form
+    {
+        padding
+        {
+            left = 2
+            right = 2
+            top = 2
+            bottom = 2
+        }
+
+        stateNormal
+        {
+            skin = FormSkin
+            imageList = normalImages
+        }
+
+        stateHover
+        {
+            imageList = hoverImages
+        }
+
+        stateActive
+        {
+            imageList = activeImages
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style Container
+    {
+        stateNormal
+        {
+            imageList = normalImages
+        }
+
+        stateHover
+        {
+            imageList = hoverImages
+        }
+
+        stateActive
+        {
+            imageList = activeImages
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style Label
+    {
+        stateNormal
+        {
+            font = ${font}
+            fontSize = ${fontSize}
+            textColor = ${textColor}
+            textAlignment = ALIGN_VCENTER_LEFT
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style Button
+    {
+        padding
+        {
+            left = 8
+            right = 8
+            top = 4
+            bottom = 4
+        }
+
+        stateNormal
+        {
+            skin = ButtonSkin
+            font = ${font}
+            textColor = ${textColor}
+            fontSize = ${fontSize}
+            textAlignment = ALIGN_VCENTER_HCENTER
+        }
+
+        stateHover
+        {
+            skin = ButtonSkinHover
+        }
+
+        stateActive
+        {
+            skin = ButtonSkinActive
+        }
+
+        stateFocus
+        {
+            skin = ButtonSkinFocus
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style CheckBox : Label
+    {
+        stateNormal
+        {
+            imageList = normalImages
+        }
+
+        stateHover
+        {
+            imageList = hoverImages
+        }
+
+        stateActive
+        {
+            imageList = activeImages
+        }
+
+        stateFocus
+        {
+            imageList = hoverImages
+        }
+    }
+
+    style RadioButton : CheckBox
+    {
+    }
+
+    style TextBox
+    {
+        stateNormal
+        {
+            skin = TextBoxSkin
+            imageList = normalImages
+            font = ${font}
+            fontSize = ${fontSize}
+            textColor = ${textColor}
+            textAlignment = ALIGN_TOP_LEFT
+        }
+
+        stateHover
+        {
+            skin = TextBoxSkinHover
+        }
+
+        stateActive
+        {
+            skin = TextBoxSkinActive
+            imageList = activeImages
+        }
+
+        stateFocus
+        {
+            skin = TextBoxSkinHover
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style Slider
+    {
+        stateNormal
+        {
+            imageList = normalImages
+            font = ${font}
+            fontSize = ${fontSize}
+            textColor = ${textColor}
+            textAlignment = ALIGN_TOP_LEFT
+        }
+
+        stateHover
+        {
+            imageList = hoverImages
+        }
+
+        stateActive
+        {
+            imageList = activeImages
+        }
+
+        stateFocus
+        {
+            imageList = hoverImages
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    style Image
+    {
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+
+    // Empty style that has no skin
+    style Empty
+    {
+    }
+
+    // Style that can be used as a background for a container
+    style Panel
+    {
+        stateNormal
+        {
+            skin = PanelSkin
+            font = ${font}
+            fontSize = ${fontSize}
+            textColor = ${textColor}
+            textAlignment = ALIGN_VCENTER_HCENTER
+            imageList = normalImages
+        }
+
+        stateHover
+        {
+            imageList = hoverImages
+        }
+
+        stateActive
+        {
+            imageList = activeImages
+        }
+
+        stateDisabled
+        {
+            opacity = ${disabledOpacity}
+        }
+    }
+}

+ 2 - 16
gameplay/src/AbsoluteLayout.cpp

@@ -36,23 +36,9 @@ Layout::Type AbsoluteLayout::getType()
     return Layout::LAYOUT_ABSOLUTE;
     return Layout::LAYOUT_ABSOLUTE;
 }
 }
 
 
-void AbsoluteLayout::update(const Container* container, const Vector2& offset)
+void AbsoluteLayout::update(const Container* container)
 {
 {
-    GP_ASSERT(container);
-
-    // An AbsoluteLayout does nothing to modify the layout of Controls.
-    const std::vector<Control*>& controls = container->getControls();
-    for (size_t i = 0, count = controls.size(); i < count; i++)
-    {
-        Control* control = controls[i];
-        GP_ASSERT(control);
-
-        if (control->isVisible())
-        {
-            align(control, container);
-            control->update(container, offset);
-        }
-    }
+    // Nothing to do for absolute layout
 }
 }
 
 
 }
 }

+ 1 - 2
gameplay/src/AbsoluteLayout.h

@@ -33,9 +33,8 @@ protected:
      * It simply calls update() on any control that is dirty.
      * It simply calls update() on any control that is dirty.
      *
      *
      * @param container The container to update.
      * @param container The container to update.
-     * @param offset The layout offset.
      */
      */
-    void update(const Container* container, const Vector2& offset);
+    void update(const Container* container);
 
 
 private:
 private:
     
     

+ 29 - 55
gameplay/src/CheckBox.cpp

@@ -35,7 +35,6 @@ void CheckBox::initialize(const char* typeName, Theme::Style* style, Properties*
 
 
     if (properties)
     if (properties)
     {
     {
-        properties->getVector2("imageSize", &_imageSize);
         _checked = properties->getBool("checked");
         _checked = properties->getBool("checked");
     }
     }
 }
 }
@@ -50,22 +49,11 @@ void CheckBox::setChecked(bool checked)
     if (_checked != checked)
     if (_checked != checked)
     {
     {
         _checked = checked;
         _checked = checked;
-        _dirty = true;
+        setDirty(DIRTY_STATE);
         notifyListeners(Control::Listener::VALUE_CHANGED);
         notifyListeners(Control::Listener::VALUE_CHANGED);
     }
     }
 }
 }
 
 
-void CheckBox::setImageSize(float width, float height)
-{
-    _imageSize.set(width, height);
-    _dirty = true;
-}
-
-const Vector2& CheckBox::getImageSize() const
-{
-    return _imageSize;
-}
-
 void CheckBox::addListener(Control::Listener* listener, int eventFlags)
 void CheckBox::addListener(Control::Listener* listener, int eventFlags)
 {
 {
     if ((eventFlags & Control::Listener::TEXT_CHANGED) == Control::Listener::TEXT_CHANGED)
     if ((eventFlags & Control::Listener::TEXT_CHANGED) == Control::Listener::TEXT_CHANGED)
@@ -99,53 +87,49 @@ void CheckBox::controlEvent(Control::Listener::EventType evt)
     }
     }
 }
 }
 
 
-void CheckBox::update(const Control* container, const Vector2& offset)
+void CheckBox::updateState(State state)
 {
 {
-    Label::update(container, offset);
+    Label::updateState(state);
+
+    _image = getImage(_checked ? "checked" : "unchecked", state);
+}
 
 
-    Control::State state = getState();
+void CheckBox::updateBounds()
+{
+    Label::updateBounds();
 
 
     Vector2 size;
     Vector2 size;
-    if (_imageSize.isZero())
+    if (_checked)
     {
     {
-        if (_checked)
-        {
-            const Rectangle& selectedRegion = getImageRegion("checked", state);
-            size.set(selectedRegion.width, selectedRegion.height);
-        }
-        else
-        {
-            const Rectangle& unselectedRegion = getImageRegion("unchecked", state);
-            size.set(unselectedRegion.width, unselectedRegion.height);
-        }
+        const Rectangle& selectedRegion = getImageRegion("checked", NORMAL);
+        size.set(selectedRegion.width, selectedRegion.height);
     }
     }
     else
     else
     {
     {
-        size.set(_imageSize);
+        const Rectangle& unselectedRegion = getImageRegion("unchecked", NORMAL);
+        size.set(unselectedRegion.width, unselectedRegion.height);
     }
     }
-    
-    if (_autoWidth == Control::AUTO_SIZE_FIT)
+
+    if (_autoSize & AUTO_SIZE_HEIGHT)
     {
     {
         // Text-only width was already measured in Label::update - append image
         // Text-only width was already measured in Label::update - append image
-        setWidth(size.x + _bounds.width + 5);
+        const Theme::Border& border = getBorder(NORMAL);
+        const Theme::Border& padding = getPadding();
+        setHeightInternal(std::max(_bounds.height, size.y + border.top + border.bottom + padding.top + padding.bottom));
     }
     }
 
 
-    if (_autoHeight == Control::AUTO_SIZE_FIT)
+    if (_autoSize & AUTO_SIZE_WIDTH)
     {
     {
         // Text-only width was already measured in Label::update - append image
         // Text-only width was already measured in Label::update - append image
-        setHeight(std::max(getHeight(), size.y));
+        setWidthInternal(_bounds.height + 5 + _bounds.width);
     }
     }
+}
 
 
-    _textBounds.x += size.x + 5;
-    
-    if (_checked)
-    {
-        _image = getImage("checked", state);
-    }
-    else
-    {
-        _image = getImage("unchecked", state);
-    }
+void CheckBox::updateAbsoluteBounds(const Vector2& offset)
+{
+    Label::updateAbsoluteBounds(offset);
+
+    _textBounds.x += _bounds.height + 5;
 }
 }
 
 
 unsigned int CheckBox::drawImages(Form* form, const Rectangle& clip)
 unsigned int CheckBox::drawImages(Form* form, const Rectangle& clip)
@@ -161,21 +145,11 @@ unsigned int CheckBox::drawImages(Form* form, const Rectangle& clip)
     Vector4 color = _image->getColor();
     Vector4 color = _image->getColor();
     color.w *= _opacity;
     color.w *= _opacity;
 
 
-    Vector2 size;
-    if (_imageSize.isZero())
-    {
-        size.set(region.width, region.height);
-    }
-    else
-    {
-        size.set(_imageSize);
-    }
-
-    Vector2 pos(_viewportBounds.x, _viewportBounds.y + _viewportBounds.height * 0.5f - size.y * 0.5f);
+    Vector2 pos(_viewportBounds.x, _viewportBounds.y);
 
 
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     startBatch(form, batch);
     startBatch(form, batch);
-    batch->draw(pos.x, pos.y, size.x, size.y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
+    batch->draw(pos.x, pos.y, _viewportBounds.height, _viewportBounds.height, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
     finishBatch(form, batch);
     finishBatch(form, batch);
 
 
     return 1;
     return 1;

+ 12 - 26
gameplay/src/CheckBox.h

@@ -48,21 +48,6 @@ public:
      */
      */
     void setChecked(bool checked);
     void setChecked(bool checked);
 
 
-    /**
-     * Set the size to draw the checkbox icon.
-     *
-     * @param width The width to draw the checkbox icon.
-     * @param height The height to draw the checkbox icon.
-     */
-    void setImageSize(float width, float height);
-
-    /**
-     * Get the size at which the checkbox icon will be drawn.
-     *
-     * @return The size of the checkbox icon.
-     */
-    const Vector2& getImageSize() const;
-
     /**
     /**
      * @see Control::getType
      * @see Control::getType
      */
      */
@@ -121,13 +106,19 @@ protected:
     void controlEvent(Control::Listener::EventType evt);
     void controlEvent(Control::Listener::EventType evt);
 
 
     /**
     /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This control's parent container.
-     * @param offset The position offset.
+     * @see Control::updateState
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateState(State state);
+
+    /**
+     * @see Control::updateBounds
+     */
+    void updateBounds();
+
+    /**
+     * @see Control::updateAbsoluteBounds
+     */
+    void updateAbsoluteBounds(const Vector2& offset);
 
 
     /**
     /**
      * @see Control::drawImages
      * @see Control::drawImages
@@ -139,11 +130,6 @@ protected:
      */
      */
     bool _checked;
     bool _checked;
 
 
-    /**
-     * The size to draw the checkbox icon, if different from its size in the texture.
-     */
-    Vector2 _imageSize;
-
     /**
     /**
      * The Theme::ThemeImage to display for the checkbox.
      * The Theme::ThemeImage to display for the checkbox.
      */
      */

+ 184 - 138
gameplay/src/Container.cpp

@@ -25,6 +25,8 @@ static const long SCROLL_INERTIA_DELAY = 100L;
 static const float SCROLL_FRICTION_FACTOR = 5.0f;
 static const float SCROLL_FRICTION_FACTOR = 5.0f;
 // Distance that must be scrolled before isScrolling() will return true, used e.g. to cancel button-click events.
 // Distance that must be scrolled before isScrolling() will return true, used e.g. to cancel button-click events.
 static const float SCROLL_THRESHOLD = 10.0f;
 static const float SCROLL_THRESHOLD = 10.0f;
+// Number of milliseconds to fade auto-hide scrollbars out for
+static const long SCROLLBAR_FADE_TIME = 1500L;
 // If the DPad or joystick is held down, this is the initial delay in milliseconds between focus change events.
 // If the DPad or joystick is held down, this is the initial delay in milliseconds between focus change events.
 static const float FOCUS_CHANGE_REPEAT_DELAY = 300.0f;
 static const float FOCUS_CHANGE_REPEAT_DELAY = 300.0f;
 
 
@@ -55,7 +57,7 @@ Container::Container()
       _scrollingMouseVertically(false), _scrollingMouseHorizontally(false),
       _scrollingMouseVertically(false), _scrollingMouseHorizontally(false),
       _scrollBarOpacityClip(NULL), _zIndexDefault(0),
       _scrollBarOpacityClip(NULL), _zIndexDefault(0),
       _selectButtonDown(false), _lastFrameTime(0), _totalWidth(0), _totalHeight(0),
       _selectButtonDown(false), _lastFrameTime(0), _totalWidth(0), _totalHeight(0),
-      _initializedWithScroll(false), _scrollWheelRequiresFocus(false), _allowRelayout(true)
+      _initializedWithScroll(false), _scrollWheelRequiresFocus(false)
 {
 {
 	clearContacts();
 	clearContacts();
 }
 }
@@ -126,7 +128,6 @@ void Container::initialize(const char* typeName, Theme::Style* style, Properties
 			_scrollWheelSpeed = properties->getFloat("scrollWheelSpeed");
 			_scrollWheelSpeed = properties->getFloat("scrollWheelSpeed");
 
 
 		addControls(properties);
 		addControls(properties);
-		_layout->update(this, _scrollPosition);
 
 
 		const char* activeControl = properties->getString("activeControl");
 		const char* activeControl = properties->getString("activeControl");
 		if (activeControl)
 		if (activeControl)
@@ -188,8 +189,7 @@ void Container::setLayout(Layout::Type type)
 		SAFE_RELEASE(_layout);
 		SAFE_RELEASE(_layout);
 
 
 		_layout = createLayout(type);
 		_layout = createLayout(type);
-		_layout->update(this, _scrollPosition);
-		_dirty = true;
+        setDirty(Control::DIRTY_BOUNDS);
 	}
 	}
 }
 }
 
 
@@ -363,11 +363,18 @@ void Container::setScroll(Scroll scroll)
     if (scroll != _scroll)
     if (scroll != _scroll)
     {
     {
         _scroll = scroll;
         _scroll = scroll;
-        _dirty = true;
 
 
-        // Scrollable containers can be focused (to allow scrolling)
-        if (_scroll != SCROLL_NONE)
+        if (_scroll == SCROLL_NONE)
+        {
+            _scrollPosition.set(0, 0);
+        }
+        else
+        {
+            // Scrollable containers can be focused (to allow scrolling)
             _canFocus = true;
             _canFocus = true;
+        }
+
+        setDirty(DIRTY_BOUNDS | DIRTY_STATE);
     }
     }
 }
 }
 
 
@@ -381,7 +388,7 @@ void Container::setScrollBarsAutoHide(bool autoHide)
     if (autoHide != _scrollBarsAutoHide)
     if (autoHide != _scrollBarsAutoHide)
     {
     {
         _scrollBarsAutoHide = autoHide;
         _scrollBarsAutoHide = autoHide;
-        _dirty = true;
+        setDirty(DIRTY_BOUNDS | DIRTY_STATE);
     }
     }
 }
 }
 
 
@@ -494,12 +501,28 @@ void Container::setActiveControl(Control* control)
     }
     }
 }
 }
 
 
-void Container::update(const Control* container, const Vector2& offset)
+void Container::setChildrenDirty(int bits, bool recursive)
 {
 {
-    // Update this container's viewport.
-    Control::update(container, offset);
+    for (size_t i = 0, count = _controls.size(); i < count; ++i)
+    {
+        Control* ctrl = _controls[i];
+        ctrl->setDirty(bits);
+        if (recursive && ctrl->isContainer())
+            static_cast<Container*>(ctrl)->setChildrenDirty(bits, true);
+    }
+}
 
 
-    Control::State state = getState();
+void Container::update(float elapsedTime)
+{
+    Control::update(elapsedTime);
+
+    for (size_t i = 0, count = _controls.size(); i < count; ++i)
+        _controls[i]->update(elapsedTime);
+}
+
+void Container::updateState(State state)
+{
+    Control::updateState(state);
 
 
     // Get scrollbar images and diminish clipping bounds to make room for scrollbars.
     // Get scrollbar images and diminish clipping bounds to make room for scrollbars.
     if ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
     if ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
@@ -507,11 +530,6 @@ void Container::update(const Control* container, const Vector2& offset)
         _scrollBarLeftCap = getImage("scrollBarLeftCap", state);
         _scrollBarLeftCap = getImage("scrollBarLeftCap", state);
         _scrollBarHorizontal = getImage("horizontalScrollBar", state);
         _scrollBarHorizontal = getImage("horizontalScrollBar", state);
         _scrollBarRightCap = getImage("scrollBarRightCap", state);
         _scrollBarRightCap = getImage("scrollBarRightCap", state);
-
-        GP_ASSERT(_scrollBarLeftCap && _scrollBarHorizontal && _scrollBarRightCap);
-
-        _viewportBounds.height -= _scrollBarHorizontal->getRegion().height;
-        _viewportClipBounds.height -= _scrollBarHorizontal->getRegion().height;
     }
     }
 
 
     if ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL)
     if ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL)
@@ -519,97 +537,113 @@ void Container::update(const Control* container, const Vector2& offset)
         _scrollBarTopCap = getImage("scrollBarTopCap", state);
         _scrollBarTopCap = getImage("scrollBarTopCap", state);
         _scrollBarVertical = getImage("verticalScrollBar", state);
         _scrollBarVertical = getImage("verticalScrollBar", state);
         _scrollBarBottomCap = getImage("scrollBarBottomCap", state);
         _scrollBarBottomCap = getImage("scrollBarBottomCap", state);
-
-        GP_ASSERT(_scrollBarTopCap && _scrollBarVertical && _scrollBarBottomCap);
-
-        _viewportBounds.width -= _scrollBarVertical->getRegion().width;
-        _viewportClipBounds.width -= _scrollBarVertical->getRegion().width;
     }
     }
+}
 
 
-    GP_ASSERT(_layout);
-    if (_scroll != SCROLL_NONE)
-    {
-        updateScroll();
-    }
-    else
-    {
-        _layout->update(this, Vector2::zero());
-    }
+void Container::updateBounds()
+{
+    // Compute total bounds of container
+    Control::updateBounds();
 
 
     // Handle automatically sizing based on our children
     // Handle automatically sizing based on our children
-    if (_autoWidth == Control::AUTO_SIZE_FIT || _autoHeight == Control::AUTO_SIZE_FIT)
+    if (_autoSize != AUTO_SIZE_NONE)
     {
     {
-        Vector2 oldSize(_bounds.width, _bounds.height);
-        bool sizeChanged = false;
-        bool relayout = false;
-
-        if (_autoWidth == Control::AUTO_SIZE_FIT)
+        if (_autoSize & AUTO_SIZE_WIDTH)
         {
         {
             // Size ourself to tightly fit the width of our children
             // Size ourself to tightly fit the width of our children
             float width = 0;
             float width = 0;
-            for (std::vector<Control*>::const_iterator it = _controls.begin(); it < _controls.end(); ++it)
+            for (size_t i = 0, count = _controls.size(); i < count; ++i)
             {
             {
-                Control* ctrl = *it;
-                if (ctrl->isXPercentage() || ctrl->isWidthPercentage())
-                {
-                    // We (this control's parent) are resizing and our child's layout
-                    // depends on our size, so we need to dirty it
-                    ctrl->_dirty = true;
-                    relayout = _allowRelayout;
-                }
-                else
+                Control* ctrl = _controls[i];
+                if (!ctrl->isXPercentage() && !ctrl->isWidthPercentage())
                 {
                 {
                     float w = ctrl->getX() + ctrl->getWidth();
                     float w = ctrl->getX() + ctrl->getWidth();
                     if (width < w)
                     if (width < w)
                         width = w;
                         width = w;
                 }
                 }
             }
             }
-            width += getBorder(state).left + getBorder(state).right + getPadding().left + getPadding().right;
-            if (width != oldSize.x)
-            {
-                setWidth(width);
-                sizeChanged = true;
-            }
+            width += getBorder(NORMAL).left + getBorder(NORMAL).right + getPadding().left + getPadding().right;
+            setWidthInternal(width);
         }
         }
 
 
-        if (_autoHeight == Control::AUTO_SIZE_FIT)
+        if (_autoSize & AUTO_SIZE_HEIGHT)
         {
         {
             // Size ourself to tightly fit the height of our children
             // Size ourself to tightly fit the height of our children
             float height = 0;
             float height = 0;
-            for (std::vector<Control*>::const_iterator it = _controls.begin(); it < _controls.end(); ++it)
+            for (size_t i = 0, count = _controls.size(); i < count; ++i)
             {
             {
-                Control* ctrl = *it;
-                if (ctrl->isYPercentage() || ctrl->isHeightPercentage())
-                {
-                    // We (this control's parent) are resizing and our child's layout
-                    // depends on our size, so we need to dirty it
-                    ctrl->_dirty = true;
-                    relayout = _allowRelayout;
-                }
-                else
+                Control* ctrl = _controls[i];
+                if (!ctrl->isYPercentage() && !ctrl->isHeightPercentage())
                 {
                 {
                     float h = ctrl->getY() + ctrl->getHeight();
                     float h = ctrl->getY() + ctrl->getHeight();
                     if (height < h)
                     if (height < h)
                         height = h;
                         height = h;
                 }
                 }
             }
             }
-            height += getBorder(state).top + getBorder(state).bottom + getPadding().top + getPadding().bottom;
-            if (height != oldSize.y)
-            {
-                setHeight(height);
-                sizeChanged = true;
-            }
+            height += getBorder(NORMAL).top + getBorder(NORMAL).bottom + getPadding().top + getPadding().bottom;
+            setHeightInternal(height);
         }
         }
+    }
+
+    // Update layout to position children correctly within us
+    GP_ASSERT(_layout);
+    _layout->update(this);
+}
+
+void Container::updateAbsoluteBounds(const Vector2& offset)
+{
+    Control::updateAbsoluteBounds(offset);
+
+    // Get scrollbar images and diminish clipping bounds to make room for scrollbars.
+    if ((_scroll & SCROLL_HORIZONTAL) == SCROLL_HORIZONTAL)
+    {
+        GP_ASSERT(_scrollBarLeftCap && _scrollBarHorizontal && _scrollBarRightCap);
+        _viewportBounds.height -= _scrollBarHorizontal->getRegion().height;
+        _viewportClipBounds.height -= _scrollBarHorizontal->getRegion().height;
+    }
+
+    if ((_scroll & SCROLL_VERTICAL) == SCROLL_VERTICAL)
+    {
+        GP_ASSERT(_scrollBarTopCap && _scrollBarVertical && _scrollBarBottomCap);
+        _viewportBounds.width -= _scrollBarVertical->getRegion().width;
+        _viewportClipBounds.width -= _scrollBarVertical->getRegion().width;
+    }
+
+    // Update scroll position and scrollbars after updating absolute bounds since
+    // computation relies on up-to-date absolute bounds information.
+    updateScroll();
+}
+
+bool Container::updateChildBounds()
+{
+    bool result = false;
+
+    for (size_t i = 0, count = _controls.size(); i < count; ++i)
+    {
+        Control* ctrl = _controls[i];
+        GP_ASSERT(ctrl);
 
 
-        if (sizeChanged && relayout)
+        if (ctrl->isVisible())
         {
         {
-            // Our size changed and as a result we need to force another layout.
-            // Prevent infinitely recursive layouts by disabling relayout for the next call.
-            _allowRelayout = false;
-            update(container, offset);
-            _allowRelayout = true;
+            bool changed = ctrl->updateBoundsInternal(_scrollPosition);
+
+            // If the child bounds have changed, dirty our bounds and all of our
+            // parent bounds so that our layout and/or bounds are recomputed.
+            if (changed)
+            {
+                Control* parent = this;
+                while (parent && parent->_autoSize != AUTO_SIZE_NONE)
+                {
+                    parent->setDirty(DIRTY_BOUNDS);
+                    parent = parent->_parent;
+                }
+            }
+
+            result = result || changed;
         }
         }
     }
     }
+
+    return result;
 }
 }
 
 
 unsigned int Container::draw(Form* form, const Rectangle& clip)
 unsigned int Container::draw(Form* form, const Rectangle& clip)
@@ -634,7 +668,7 @@ unsigned int Container::draw(Form* form, const Rectangle& clip)
     if (_scroll != SCROLL_NONE && (_scrollBarOpacity > 0.0f))
     if (_scroll != SCROLL_NONE && (_scrollBarOpacity > 0.0f))
     {
     {
         // Draw scroll bars.
         // Draw scroll bars.
-        Rectangle clipRegion(_viewportClipBounds);
+        Rectangle clipRegion(_absoluteClipBounds);
 
 
         SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
         SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
         startBatch(form, batch);
         startBatch(form, batch);
@@ -658,7 +692,7 @@ unsigned int Container::draw(Form* form, const Rectangle& clip)
 
 
             clipRegion.width += verticalRegion.width;
             clipRegion.width += verticalRegion.width;
 
 
-            Rectangle bounds(_viewportBounds.x + _viewportBounds.width, _viewportBounds.y + _scrollBarBounds.y, topRegion.width, topRegion.height);
+            Rectangle bounds(_viewportBounds.right() + (_absoluteBounds.right() - _viewportBounds.right())*0.5f - topRegion.width*0.5f, _viewportBounds.y + _scrollBarBounds.y, topRegion.width, topRegion.height);
             batch->draw(bounds.x, bounds.y, bounds.width, bounds.height, topUVs.u1, topUVs.v1, topUVs.u2, topUVs.v2, topColor, clipRegion);
             batch->draw(bounds.x, bounds.y, bounds.width, bounds.height, topUVs.u1, topUVs.v1, topUVs.u2, topUVs.v2, topColor, clipRegion);
 
 
             bounds.y += topRegion.height;
             bounds.y += topRegion.height;
@@ -691,7 +725,7 @@ unsigned int Container::draw(Form* form, const Rectangle& clip)
 
 
             clipRegion.height += horizontalRegion.height;
             clipRegion.height += horizontalRegion.height;
         
         
-            Rectangle bounds(_viewportBounds.x + _scrollBarBounds.x, _viewportBounds.y + _viewportBounds.height, leftRegion.width, leftRegion.height);
+            Rectangle bounds(_viewportBounds.x + _scrollBarBounds.x, _viewportBounds.bottom() + (_absoluteBounds.bottom() - _viewportBounds.bottom())*0.5f - leftRegion.height*0.5f, leftRegion.width, leftRegion.height);
             batch->draw(bounds.x, bounds.y, bounds.width, bounds.height, leftUVs.u1, leftUVs.v1, leftUVs.u2, leftUVs.v2, leftColor, clipRegion);
             batch->draw(bounds.x, bounds.y, bounds.width, bounds.height, leftUVs.u1, leftUVs.v1, leftUVs.u2, leftUVs.v2, leftColor, clipRegion);
 
 
             bounds.x += leftRegion.width;
             bounds.x += leftRegion.width;
@@ -711,28 +745,6 @@ unsigned int Container::draw(Form* form, const Rectangle& clip)
     return drawCalls;
     return drawCalls;
 }
 }
 
 
-bool Container::isDirty()
-{
-    if (_dirty)
-    {
-        return true;
-    }
-    else
-    {
-        std::vector<Control*>::const_iterator it;
-        for (it = _controls.begin(); it < _controls.end(); it++)
-        {
-            GP_ASSERT(*it);
-            if ((*it)->isDirty())
-            {
-                return true;
-            }
-        }
-    }
-
-    return false;
-}
-
 static bool canReceiveFocus(Control* control)
 static bool canReceiveFocus(Control* control)
 {
 {
     if (control->getFocusIndex() < 0 || !(control->isEnabled() && control->isVisible()))
     if (control->getFocusIndex() < 0 || !(control->isEnabled() && control->isVisible()))
@@ -971,7 +983,7 @@ void Container::startScrolling(float x, float y, bool resetTime)
     _scrollingVelocity.set(-x, y);
     _scrollingVelocity.set(-x, y);
     _scrolling = true;
     _scrolling = true;
     _scrollBarOpacity = 1.0f;
     _scrollBarOpacity = 1.0f;
-    _dirty = true;
+    setDirty(DIRTY_BOUNDS);
 
 
     if (_scrollBarOpacityClip && _scrollBarOpacityClip->isPlaying())
     if (_scrollBarOpacityClip && _scrollBarOpacityClip->isPlaying())
     {
     {
@@ -989,7 +1001,7 @@ void Container::stopScrolling()
 {
 {
     _scrollingVelocity.set(0, 0);
     _scrollingVelocity.set(0, 0);
     _scrolling = false;
     _scrolling = false;
-    _dirty = true;
+    setDirty(DIRTY_BOUNDS);
 
 
     if (_parent)
     if (_parent)
         _parent->stopScrolling();
         _parent->stopScrolling();
@@ -1045,11 +1057,8 @@ Layout* Container::createLayout(Layout::Type type)
 
 
 void Container::updateScroll()
 void Container::updateScroll()
 {
 {
-    if (!_initializedWithScroll)
-    {
-        _initializedWithScroll = true;
-        _layout->update(this, _scrollPosition);
-    }
+    if (_scroll == SCROLL_NONE)
+        return;
 
 
     Control::State state = getState();
     Control::State state = getState();
 
 
@@ -1068,9 +1077,9 @@ void Container::updateScroll()
     // Calculate total width and height.
     // Calculate total width and height.
     _totalWidth = _totalHeight = 0.0f;
     _totalWidth = _totalHeight = 0.0f;
     std::vector<Control*> controls = getControls();
     std::vector<Control*> controls = getControls();
-    for (size_t i = 0, controlsCount = controls.size(); i < controlsCount; i++)
+    for (size_t i = 0, count = controls.size(); i < count; ++i)
     {
     {
-        Control* control = controls.at(i);
+        Control* control = _controls[i];
 
 
         const Rectangle& bounds = control->getBounds();
         const Rectangle& bounds = control->getBounds();
         const Theme::Margin& margin = control->getMargin();
         const Theme::Margin& margin = control->getMargin();
@@ -1093,6 +1102,8 @@ void Container::updateScroll()
     float clipWidth = _absoluteBounds.width - containerBorder.left - containerBorder.right - containerPadding.left - containerPadding.right - vWidth;
     float clipWidth = _absoluteBounds.width - containerBorder.left - containerBorder.right - containerPadding.left - containerPadding.right - vWidth;
     float clipHeight = _absoluteBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom - hHeight;
     float clipHeight = _absoluteBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom - hHeight;
 
 
+    bool dirty = false;
+
     // Apply and dampen inertia.
     // Apply and dampen inertia.
     if (!_scrollingVelocity.isZero())
     if (!_scrollingVelocity.isZero())
     {
     {
@@ -1113,6 +1124,8 @@ void Container::updateScroll()
             if (fabs(_scrollingVelocity.y) < 100.0f)
             if (fabs(_scrollingVelocity.y) < 100.0f)
                 _scrollingVelocity.y = 0.0f;
                 _scrollingVelocity.y = 0.0f;
         }
         }
+
+        dirty = true;
     }
     }
 
 
     // Stop scrolling when the far edge is reached.
     // Stop scrolling when the far edge is reached.
@@ -1120,24 +1133,28 @@ void Container::updateScroll()
     {
     {
         _scrollPosition.x = -(_totalWidth - clipWidth);
         _scrollPosition.x = -(_totalWidth - clipWidth);
         _scrollingVelocity.x = 0;
         _scrollingVelocity.x = 0;
+        dirty = true;
     }
     }
     
     
     if (-_scrollPosition.y > _totalHeight - clipHeight)
     if (-_scrollPosition.y > _totalHeight - clipHeight)
     {
     {
         _scrollPosition.y = -(_totalHeight - clipHeight);
         _scrollPosition.y = -(_totalHeight - clipHeight);
         _scrollingVelocity.y = 0;
         _scrollingVelocity.y = 0;
+        dirty = true;
     }
     }
 
 
     if (_scrollPosition.x > 0)
     if (_scrollPosition.x > 0)
     {
     {
         _scrollPosition.x = 0;
         _scrollPosition.x = 0;
         _scrollingVelocity.x = 0;
         _scrollingVelocity.x = 0;
+        dirty = true;
     }
     }
 
 
     if (_scrollPosition.y > 0)
     if (_scrollPosition.y > 0)
     {
     {
         _scrollPosition.y = 0;
         _scrollPosition.y = 0;
         _scrollingVelocity.y = 0;
         _scrollingVelocity.y = 0;
+        dirty = true;
     }
     }
 
 
     float scrollWidth = 0;
     float scrollWidth = 0;
@@ -1159,14 +1176,19 @@ void Container::updateScroll()
         _scrollBarOpacity = 0.99f;
         _scrollBarOpacity = 0.99f;
         if (!_scrollBarOpacityClip)
         if (!_scrollBarOpacityClip)
         {
         {
-            Animation* animation = createAnimationFromTo("scrollbar-fade-out", ANIMATE_SCROLLBAR_OPACITY, &_scrollBarOpacity, &to, Curve::QUADRATIC_IN_OUT, 500L);
+            Animation* animation = createAnimationFromTo("scrollbar-fade-out", ANIMATE_SCROLLBAR_OPACITY, &_scrollBarOpacity, &to, Curve::QUADRATIC_IN_OUT, SCROLLBAR_FADE_TIME);
             _scrollBarOpacityClip = animation->getClip();
             _scrollBarOpacityClip = animation->getClip();
         }
         }
         _scrollBarOpacityClip->play();
         _scrollBarOpacityClip->play();
     }
     }
 
 
-    // Position controls within scroll area.
-    _layout->update(this, _scrollPosition);
+    // When scroll position is updated, we need to recompute bounds since children
+    // absolute bounds offset will need to be updated.
+    if (dirty)
+    {
+        setDirty(DIRTY_BOUNDS);
+        setChildrenDirty(DIRTY_BOUNDS, true);
+    }
 }
 }
 
 
 void Container::sortControls()
 void Container::sortControls()
@@ -1184,7 +1206,8 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
     case Touch::TOUCH_PRESS:
     case Touch::TOUCH_PRESS:
         if (_contactIndex == INVALID_CONTACT_INDEX)
         if (_contactIndex == INVALID_CONTACT_INDEX)
         {
         {
-            _contactIndex = (int) contactIndex;
+            bool dirty = !_scrollingVelocity.isZero();
+            _contactIndex = (int)contactIndex;
             _scrollingLastX = _scrollingFirstX = _scrollingVeryFirstX = x;
             _scrollingLastX = _scrollingFirstX = _scrollingVeryFirstX = x;
             _scrollingLastY = _scrollingFirstY = _scrollingVeryFirstY = y;
             _scrollingLastY = _scrollingFirstY = _scrollingVeryFirstY = y;
             _scrollingVelocity.set(0, 0);
             _scrollingVelocity.set(0, 0);
@@ -1197,13 +1220,14 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
                 _scrollBarOpacityClip = NULL;
                 _scrollBarOpacityClip = NULL;
             }
             }
             _scrollBarOpacity = 1.0f;
             _scrollBarOpacity = 1.0f;
-            _dirty = true;
+            if (dirty)
+                setDirty(DIRTY_BOUNDS);
             return false;
             return false;
         }
         }
         break;
         break;
 
 
     case Touch::TOUCH_MOVE:
     case Touch::TOUCH_MOVE:
-        if (_scrolling && _contactIndex == (int) contactIndex)
+        if (_scrolling && _contactIndex == (int)contactIndex)
         {
         {
             double gameTime = Game::getAbsoluteTime();
             double gameTime = Game::getAbsoluteTime();
 
 
@@ -1260,8 +1284,9 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
                 _scrollingStartTimeY = gameTime;
                 _scrollingStartTimeY = gameTime;
 
 
             _scrollingLastTime = gameTime;
             _scrollingLastTime = gameTime;
-            _dirty = true;
-            return _consumeInputEvents;
+            setDirty(DIRTY_BOUNDS);
+            setChildrenDirty(DIRTY_BOUNDS, true);
+            return false;
         }
         }
         break;
         break;
 
 
@@ -1276,8 +1301,7 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
             {
             {
                 _scrollingVelocity.set(0, 0);
                 _scrollingVelocity.set(0, 0);
                 _scrollingMouseVertically = _scrollingMouseHorizontally = false;
                 _scrollingMouseVertically = _scrollingMouseHorizontally = false;
-                _dirty = true;
-                return _consumeInputEvents;
+                return false;
             }
             }
 
 
             int dx = _scrollingLastX - _scrollingFirstX;
             int dx = _scrollingLastX - _scrollingFirstX;
@@ -1313,8 +1337,8 @@ bool Container::touchEventScroll(Touch::TouchEvent evt, int x, int y, unsigned i
             }
             }
 
 
             _scrollingMouseVertically = _scrollingMouseHorizontally = false;
             _scrollingMouseVertically = _scrollingMouseHorizontally = false;
-            _dirty = true;
-            return _consumeInputEvents;
+            setDirty(DIRTY_BOUNDS);
+            return false;
         }
         }
         break;
         break;
     }
     }
@@ -1328,25 +1352,31 @@ bool Container::mouseEventScroll(Mouse::MouseEvent evt, int x, int y, int wheelD
     {
     {
         case Mouse::MOUSE_PRESS_LEFT_BUTTON:
         case Mouse::MOUSE_PRESS_LEFT_BUTTON:
         {
         {
+            bool dirty = false;
             if (_scrollBarVertical)
             if (_scrollBarVertical)
             {
             {
                 float vWidth = _scrollBarVertical->getRegion().width;
                 float vWidth = _scrollBarVertical->getRegion().width;
-                Rectangle vBounds(_viewportBounds.right() - _absoluteBounds.x,
-                                 _scrollBarBounds.y,
-                                 vWidth, _scrollBarBounds.height);
-
-                if (x >= vBounds.x &&
-                    x <= vBounds.x + vBounds.width)
+                float rightPadding = _absoluteBounds.right() - _viewportBounds.right();
+                float topPadding = _viewportBounds.y - _absoluteBounds.y;
+                float localVpRight = _bounds.width - rightPadding;
+                Rectangle vBounds(
+                    localVpRight + rightPadding*0.5f - vWidth*0.5f,
+                    topPadding + _scrollBarBounds.y,
+                    vWidth, _scrollBarBounds.height);
+
+                if (x >= vBounds.x && x <= vBounds.right())
                 {
                 {
                     // Then we're within the horizontal bounds of the vertical scrollbar.
                     // Then we're within the horizontal bounds of the vertical scrollbar.
                     // We want to either jump up or down, or drag the scrollbar itself.
                     // We want to either jump up or down, or drag the scrollbar itself.
                     if (y < vBounds.y)
                     if (y < vBounds.y)
                     {
                     {
                         _scrollPosition.y += _totalHeight / 5.0f;
                         _scrollPosition.y += _totalHeight / 5.0f;
+                        dirty = true;
                     }
                     }
-                    else if (y > vBounds.y + vBounds.height)
+                    else if (y > vBounds.bottom())
                     {
                     {
                         _scrollPosition.y -= _totalHeight / 5.0f;
                         _scrollPosition.y -= _totalHeight / 5.0f;
+                        dirty = true;
                     }
                     }
                     else
                     else
                     {
                     {
@@ -1358,23 +1388,40 @@ bool Container::mouseEventScroll(Mouse::MouseEvent evt, int x, int y, int wheelD
             if (_scrollBarHorizontal)
             if (_scrollBarHorizontal)
             {
             {
                 float hHeight = _scrollBarHorizontal->getRegion().height;
                 float hHeight = _scrollBarHorizontal->getRegion().height;
-                Rectangle hBounds(_scrollBarBounds.x,
-                                  _viewportBounds.y + _viewportBounds.height,
-                                  _scrollBarBounds.width, hHeight);
-
-                if (y >= hBounds.y &&
-                    y <= hBounds.y + hBounds.height)
+                float bottomPadding = _absoluteBounds.bottom() - _viewportBounds.bottom();
+                float leftPadding = _viewportBounds.x - _absoluteBounds.x;
+                float localVpBottom = _bounds.height - bottomPadding;
+                Rectangle hBounds(
+                    leftPadding + _scrollBarBounds.x,
+                    localVpBottom + bottomPadding*0.5f - hHeight*0.5f,
+                    _scrollBarBounds.width, hHeight);
+
+                if (y >= hBounds.y && y <= hBounds.bottom())
                 {
                 {
                     // We're within the vertical bounds of the horizontal scrollbar.
                     // We're within the vertical bounds of the horizontal scrollbar.
                     if (x < hBounds.x)
                     if (x < hBounds.x)
+                    {
                         _scrollPosition.x += _totalWidth / 5.0f;
                         _scrollPosition.x += _totalWidth / 5.0f;
+                        dirty = true;
+                    }
                     else if (x > hBounds.x + hBounds.width)
                     else if (x > hBounds.x + hBounds.width)
+                    {
                         _scrollPosition.x -= _totalWidth / 5.0f;
                         _scrollPosition.x -= _totalWidth / 5.0f;
+                        dirty = true;
+                    }
                     else
                     else
+                    {
                         _scrollingMouseHorizontally = true;
                         _scrollingMouseHorizontally = true;
+                    }
                 }
                 }
             }
             }
 
 
+            if (dirty)
+            {
+                setDirty(DIRTY_BOUNDS);
+                setChildrenDirty(DIRTY_BOUNDS, true);
+            }
+
             return touchEventScroll(Touch::TOUCH_PRESS, x, y, 0);
             return touchEventScroll(Touch::TOUCH_PRESS, x, y, 0);
         }
         }
 
 
@@ -1400,8 +1447,8 @@ bool Container::mouseEventScroll(Mouse::MouseEvent evt, int x, int y, int wheelD
                 _scrollBarOpacityClip = NULL;
                 _scrollBarOpacityClip = NULL;
             }
             }
             _scrollBarOpacity = 1.0f;
             _scrollBarOpacity = 1.0f;
-            _dirty = true;
-            return _consumeInputEvents;
+            setDirty(DIRTY_BOUNDS);
+            return false;
         }
         }
     }
     }
 
 
@@ -1509,7 +1556,6 @@ void Container::setAnimationPropertyValue(int propertyId, AnimationValue* value,
     {
     {
     case ANIMATE_SCROLLBAR_OPACITY:
     case ANIMATE_SCROLLBAR_OPACITY:
         _scrollBarOpacity = Curve::lerp(blendWeight, _opacity, value->getFloat(0));
         _scrollBarOpacity = Curve::lerp(blendWeight, _opacity, value->getFloat(0));
-        _dirty = true;
         break;
         break;
     default:
     default:
         Control::setAnimationPropertyValue(propertyId, value, blendWeight);
         Control::setAnimationPropertyValue(propertyId, value, blendWeight);

+ 29 - 13
gameplay/src/Container.h

@@ -305,13 +305,37 @@ protected:
     void initialize(const char* typeName, Theme::Style* style, Properties* properties);
     void initialize(const char* typeName, Theme::Style* style, Properties* properties);
 
 
     /**
     /**
-     * Updates each control within this container,
-     * and positions them according to the container's layout.
+     * @see Control::update
+     */
+    void update(float elapsedTime);
+
+    /**
+     * @see Control::updateState
+     */
+    void updateState(State state);
+
+    /**
+     * @see Control::updateBounds
+     */
+    void updateBounds();
+
+    /**
+     * @see Control::updateAbsoluteBounds
+     */
+    void updateAbsoluteBounds(const Vector2& offset);
+
+    /**
+     * Updates the bounds for this container's child controls.
+     */
+    bool updateChildBounds();
+
+    /**
+     * Sets the specified dirty bits for all children within this container.
      *
      *
-     * @param container This container's parent container.
-     * @param offset The offset.
+     * @param bits The bits to set.
+     * @param recursive If true, set the bits recursively on all children and their children.
      */
      */
-    virtual void update(const Control* container, const Vector2& offset);
+    void setChildrenDirty(int bits, bool recursive);
 
 
     /**
     /**
      * Gets a Layout::Type enum from a matching string.
      * Gets a Layout::Type enum from a matching string.
@@ -329,13 +353,6 @@ protected:
      */
      */
     static Layout* createLayout(Layout::Type type);
     static Layout* createLayout(Layout::Type type);
 
 
-    /**
-     * Returns whether this container or any of its controls have been modified and require an update.
-     * 
-     * @return true if this container or any of its controls have been modified and require an update.
-     */
-    virtual bool isDirty();
-
     /**
     /**
      * Adds controls nested within a properties object to this container.
      * Adds controls nested within a properties object to this container.
      *
      *
@@ -564,7 +581,6 @@ private:
     bool _contactIndices[MAX_CONTACT_INDICES];
     bool _contactIndices[MAX_CONTACT_INDICES];
     bool _initializedWithScroll;
     bool _initializedWithScroll;
     bool _scrollWheelRequiresFocus;
     bool _scrollWheelRequiresFocus;
-    bool _allowRelayout;
 };
 };
 
 
 }
 }

+ 318 - 184
gameplay/src/Control.cpp

@@ -46,8 +46,8 @@ static bool parseCoordPair(const char* s, float* v1, float* v2, bool* v1Percenta
 }
 }
 
 
 Control::Control()
 Control::Control()
-    : _id(""), _enabled(true), _boundsBits(0), _dirty(true), _consumeInputEvents(true), _alignment(ALIGN_TOP_LEFT), _isAlignmentSet(false),
-    _autoWidth(AUTO_SIZE_NONE), _autoHeight(AUTO_SIZE_NONE), _style(NULL), _listeners(NULL), _visible(true), _zIndex(-1),
+    : _id(""), _enabled(true), _boundsBits(0), _dirtyBits(DIRTY_BOUNDS | DIRTY_STATE), _consumeInputEvents(true), _alignment(ALIGN_TOP_LEFT),
+    _autoSize(AUTO_SIZE_BOTH), _style(NULL), _listeners(NULL), _visible(true), _zIndex(-1),
     _contactIndex(INVALID_CONTACT_INDEX), _focusIndex(-1), _canFocus(false), _parent(NULL), _styleOverridden(false), _skin(NULL)
     _contactIndex(INVALID_CONTACT_INDEX), _focusIndex(-1), _canFocus(false), _parent(NULL), _styleOverridden(false), _skin(NULL)
 {
 {
     addScriptEvent("controlEvent", "<Control>[Control::Listener::EventType]");
     addScriptEvent("controlEvent", "<Control>[Control::Listener::EventType]");
@@ -79,15 +79,19 @@ Control::~Control()
     }
     }
 }
 }
 
 
-static Control::AutoSize parseAutoSize(const char* str)
+Control::AutoSize Control::parseAutoSize(const char* str)
 {
 {
     if (str == NULL)
     if (str == NULL)
-        return Control::AUTO_SIZE_NONE;
-    if (strcmp(str, "AUTO_SIZE_STRETCH") == 0 || strcmp(str, "true") == 0) // left for backwards compatibility
-        return Control::AUTO_SIZE_STRETCH;
-    if (strcmp(str, "AUTO_SIZE_FIT") == 0)
-        return Control::AUTO_SIZE_FIT;
-    return Control::AUTO_SIZE_NONE;
+        return _autoSize;
+
+    if (strcmpnocase(str, "AUTO_SIZE_WIDTH") == 0 )
+        return AUTO_SIZE_WIDTH;
+    if (strcmpnocase(str, "AUTO_SIZE_HEIGHT") == 0)
+        return AUTO_SIZE_HEIGHT;
+    if (strcmpnocase(str, "AUTO_SIZE_BOTH") == 0)
+        return AUTO_SIZE_BOTH;
+
+    return _autoSize;
 }
 }
 
 
 void Control::initialize(const char* typeName, Theme::Style* style, Properties* properties)
 void Control::initialize(const char* typeName, Theme::Style* style, Properties* properties)
@@ -106,8 +110,8 @@ void Control::initialize(const char* typeName, Theme::Style* style, Properties*
 
 
         if (!_style)
         if (!_style)
         {
         {
-            // Try loading a style from the default theme
-            _style = Theme::getDefault()->getStyle(styleName);
+            // Use an empty style from our parent's theme
+            _style = style->getTheme()->getEmptyStyle();
         }
         }
     }
     }
     else
     else
@@ -133,15 +137,15 @@ void Control::initialize(const char* typeName, Theme::Style* style, Properties*
 
 
     if (properties)
     if (properties)
     {
     {
+        const char* id = properties->getId();
+        if (id)
+            _id = id;
+
 		// Properties not defined by the style.
 		// Properties not defined by the style.
-		const char * alignmentString = properties->getString("alignment");
+		const char* alignmentString = properties->getString("alignment");
 
 
-		_isAlignmentSet = alignmentString != NULL;
 		_alignment = getAlignment(alignmentString);
 		_alignment = getAlignment(alignmentString);
 
 
-		_autoWidth = parseAutoSize(properties->getString("autoWidth"));
-		_autoHeight = parseAutoSize(properties->getString("autoHeight"));
-
 		_consumeInputEvents = properties->getBool("consumeInputEvents", true);
 		_consumeInputEvents = properties->getBool("consumeInputEvents", true);
 
 
 		_visible = properties->getBool("visible", true);
 		_visible = properties->getBool("visible", true);
@@ -167,35 +171,60 @@ void Control::initialize(const char* typeName, Theme::Style* style, Properties*
 			_focusIndex = -1;
 			_focusIndex = -1;
 		}
 		}
 
 
-		float bounds[4];
-		bool boundsBits[4];
-		if (properties->exists("position"))
-		{
-			parseCoordPair(properties->getString("position", "0,0"), &bounds[0], &bounds[1], &boundsBits[0], &boundsBits[1]);
+		float bounds[2];
+		bool boundsBits[2];
+        const char* position = properties->getString("position");
+        if (position && parseCoordPair(position, &bounds[0], &bounds[1], &boundsBits[0], &boundsBits[1]))
+        {
+            setX(bounds[0], boundsBits[0]);
+            setY(bounds[1], boundsBits[1]);
 		}
 		}
 		else
 		else
 		{
 		{
-			bounds[0] = parseCoord(properties->getString("x", "0"), &boundsBits[0]);
-			bounds[1] = parseCoord(properties->getString("y", "0"), &boundsBits[1]);
+            if (properties->exists("x"))
+            {
+                bounds[0] = parseCoord(properties->getString("x", "0"), &boundsBits[0]);
+                setX(bounds[0], boundsBits[0]);
+            }
+            if (properties->exists("y"))
+            {
+                bounds[1] = parseCoord(properties->getString("y", "0"), &boundsBits[1]);
+                setY(bounds[1], boundsBits[1]);
+            }
 		}
 		}
 
 
-		if (properties->exists("size"))
-		{
-			parseCoordPair(properties->getString("size", "0,0"), &bounds[2], &bounds[3], &boundsBits[2], &boundsBits[3]);
-		}
+        // If there is an explicitly specified size, width or height, unset the corresponding autoSize bit
+        const char* size = properties->getString("size");
+        if (size && parseCoordPair(size, &bounds[0], &bounds[1], &boundsBits[0], &boundsBits[1]))
+        {
+            setWidth(bounds[0], boundsBits[0]);
+            setHeight(bounds[1], boundsBits[1]);
+        }
 		else
 		else
 		{
 		{
-			bounds[2] = parseCoord(properties->getString("width", "0"), &boundsBits[2]);
-			bounds[3] = parseCoord(properties->getString("height", "0"), &boundsBits[3]);
+            const char* width = properties->getString("width");
+            if (width)
+            {
+                bounds[0] = parseCoord(width, &boundsBits[0]);
+                setWidth(bounds[0], boundsBits[0]);
+            }
+            const char* height = properties->getString("height");
+            if (height)
+            {
+                bounds[1] = parseCoord(height, &boundsBits[1]);
+                setHeight(bounds[1], boundsBits[1]);
+            }
 		}
 		}
-		setX(bounds[0], boundsBits[0]);
-		setY(bounds[1], boundsBits[1]);
-		setWidth(bounds[2], boundsBits[2]);
-		setHeight(bounds[3], boundsBits[3]);
 
 
-		const char* id = properties->getId();
-		if (id)
-			_id = id;
+        // Backwards Compatibility: Support deprecated autoWidth and autoHeight properties,
+        // which resolve to width=100% and height=100%.
+        if (properties->getBool("autoWidth"))
+            setWidth(1.0f, true);
+        if (properties->getBool("autoHeight"))
+            setHeight(1.0f, true);
+
+        // Parse the auto-size mode for the control (this overrides explicit sizes and legacy autoWidth/autoHeight)
+        _autoSize = parseAutoSize(properties->getString("autoSize"));
 
 
 		if (properties->exists("enabled"))
 		if (properties->exists("enabled"))
 		{
 		{
@@ -270,17 +299,22 @@ void Control::setX(float x, bool percentage)
 {
 {
     if (_relativeBounds.x != x || percentage != ((_boundsBits & BOUNDS_X_PERCENTAGE_BIT) != 0))
     if (_relativeBounds.x != x || percentage != ((_boundsBits & BOUNDS_X_PERCENTAGE_BIT) != 0))
     {
     {
-        _relativeBounds.x = x;
-        if (percentage)
-        {
-            _boundsBits |= BOUNDS_X_PERCENTAGE_BIT;
-        }
-        else
-        {
-            _boundsBits &= ~BOUNDS_X_PERCENTAGE_BIT;
-            _bounds.x = x;
-        }
-        _dirty = true;
+        setXInternal(x, percentage);
+        setDirty(DIRTY_BOUNDS);
+    }
+}
+
+void Control::setXInternal(float x, bool percentage)
+{
+    _relativeBounds.x = x;
+    if (percentage)
+    {
+        _boundsBits |= BOUNDS_X_PERCENTAGE_BIT;
+    }
+    else
+    {
+        _boundsBits &= ~BOUNDS_X_PERCENTAGE_BIT;
+        _bounds.x = x;
     }
     }
 }
 }
 
 
@@ -298,17 +332,22 @@ void Control::setY(float y, bool percentage)
 {
 {
     if (_relativeBounds.y != y || percentage != ((_boundsBits & BOUNDS_Y_PERCENTAGE_BIT) != 0))
     if (_relativeBounds.y != y || percentage != ((_boundsBits & BOUNDS_Y_PERCENTAGE_BIT) != 0))
     {
     {
-        _relativeBounds.y = y;
-        if (percentage)
-        {
-            _boundsBits |= BOUNDS_Y_PERCENTAGE_BIT;
-        }
-        else
-        {
-            _boundsBits &= ~BOUNDS_Y_PERCENTAGE_BIT;
-            _bounds.y = y;
-        }
-        _dirty = true;
+        setYInternal(y, percentage);
+        setDirty(DIRTY_BOUNDS);
+    }
+}
+
+void Control::setYInternal(float y, bool percentage)
+{
+    _relativeBounds.y = y;
+    if (percentage)
+    {
+        _boundsBits |= BOUNDS_Y_PERCENTAGE_BIT;
+    }
+    else
+    {
+        _boundsBits &= ~BOUNDS_Y_PERCENTAGE_BIT;
+        _bounds.y = y;
     }
     }
 }
 }
 
 
@@ -324,19 +363,26 @@ float Control::getWidth() const
 
 
 void Control::setWidth(float width, bool percentage)
 void Control::setWidth(float width, bool percentage)
 {
 {
+    _autoSize = (AutoSize)(_autoSize & ~AUTO_SIZE_WIDTH);
+
     if (_relativeBounds.width != width || percentage != ((_boundsBits & BOUNDS_WIDTH_PERCENTAGE_BIT) != 0))
     if (_relativeBounds.width != width || percentage != ((_boundsBits & BOUNDS_WIDTH_PERCENTAGE_BIT) != 0))
     {
     {
-        _relativeBounds.width = width;
-        if (percentage)
-        {
-            _boundsBits |= BOUNDS_WIDTH_PERCENTAGE_BIT;
-        }
-        else
-        {
-            _boundsBits &= ~BOUNDS_WIDTH_PERCENTAGE_BIT;
-            _bounds.width = width;
-        }
-        _dirty = true;
+        setWidthInternal(width, percentage);
+        setDirty(DIRTY_BOUNDS);
+    }
+}
+
+void Control::setWidthInternal(float width, bool percentage)
+{
+    _relativeBounds.width = width;
+    if (percentage)
+    {
+        _boundsBits |= BOUNDS_WIDTH_PERCENTAGE_BIT;
+    }
+    else
+    {
+        _boundsBits &= ~BOUNDS_WIDTH_PERCENTAGE_BIT;
+        _bounds.width = width;
     }
     }
 }
 }
 
 
@@ -352,19 +398,26 @@ float Control::getHeight() const
 
 
 void Control::setHeight(float height, bool percentage)
 void Control::setHeight(float height, bool percentage)
 {
 {
+    _autoSize = (AutoSize)(_autoSize & ~AUTO_SIZE_HEIGHT);
+
     if (_relativeBounds.height != height || percentage != ((_boundsBits & BOUNDS_HEIGHT_PERCENTAGE_BIT) != 0))
     if (_relativeBounds.height != height || percentage != ((_boundsBits & BOUNDS_HEIGHT_PERCENTAGE_BIT) != 0))
     {
     {
-        _relativeBounds.height = height;
-        if (percentage)
-        {
-            _boundsBits |= BOUNDS_HEIGHT_PERCENTAGE_BIT;
-        }
-        else
-        {
-            _boundsBits &= ~BOUNDS_HEIGHT_PERCENTAGE_BIT;
-            _bounds.height = height;
-        }
-        _dirty = true;
+        setHeightInternal(height, percentage);
+        setDirty(DIRTY_BOUNDS);
+    }
+}
+
+void Control::setHeightInternal(float height, bool percentage)
+{
+    _relativeBounds.height = height;
+    if (percentage)
+    {
+        _boundsBits |= BOUNDS_HEIGHT_PERCENTAGE_BIT;
+    }
+    else
+    {
+        _boundsBits &= ~BOUNDS_HEIGHT_PERCENTAGE_BIT;
+        _bounds.height = height;
     }
     }
 }
 }
 
 
@@ -415,51 +468,29 @@ const Rectangle& Control::getClip() const
 
 
 void Control::setAlignment(Alignment alignment)
 void Control::setAlignment(Alignment alignment)
 {
 {
-    _alignment = alignment;
-    _isAlignmentSet = true;
-    _dirty = true;
-}
-
-Control::Alignment Control::getAlignment() const
-{
-    return _alignment;
-}
-
-Control::AutoSize Control::getAutoWidth() const
-{
-    return _autoWidth;
-}
-
-void Control::setAutoWidth(bool autoWidth)
-{
-    setAutoWidth(autoWidth ? AUTO_SIZE_STRETCH : AUTO_SIZE_NONE);
-}
-
-void Control::setAutoWidth(AutoSize mode)
-{
-    if (_autoWidth != mode)
+    if (_alignment != alignment)
     {
     {
-        _autoWidth = mode;
-        _dirty = true;
+        _alignment = alignment;
+        setDirty(DIRTY_BOUNDS);
     }
     }
 }
 }
 
 
-Control::AutoSize Control::getAutoHeight() const
+Control::Alignment Control::getAlignment() const
 {
 {
-    return _autoHeight;
+    return _alignment;
 }
 }
 
 
-void Control::setAutoHeight(bool autoHeight)
+Control::AutoSize Control::getAutoSize() const
 {
 {
-    setAutoHeight(autoHeight ? AUTO_SIZE_STRETCH : AUTO_SIZE_NONE);
+    return _autoSize;
 }
 }
 
 
-void Control::setAutoHeight(AutoSize mode)
+void Control::setAutoSize(AutoSize mode)
 {
 {
-    if (_autoHeight != mode)
+    if (_autoSize != mode)
     {
     {
-        _autoHeight = mode;
-        _dirty = true;
+        _autoSize = mode;
+        setDirty(DIRTY_BOUNDS);
     }
     }
 }
 }
 
 
@@ -468,10 +499,11 @@ void Control::setVisible(bool visible)
     if (_visible != visible)
     if (_visible != visible)
     {
     {
         _visible = visible;
         _visible = visible;
-        _dirty = true;
 
 
         if (!_visible)
         if (!_visible)
             Form::controlDisabled(this);
             Form::controlDisabled(this);
+
+        setDirty(DIRTY_BOUNDS);
     }
     }
 }
 }
 
 
@@ -525,10 +557,9 @@ void Control::setOpacity(float opacity, unsigned char states)
 
 
     for (int i = 0; i < Theme::Style::OVERLAY_MAX; ++i)
     for (int i = 0; i < Theme::Style::OVERLAY_MAX; ++i)
     {
     {
-        if( overlays[i] )
+        if (overlays[i])
             overlays[i]->setOpacity(opacity);
             overlays[i]->setOpacity(opacity);
     }
     }
-    _dirty = true;
 }
 }
 
 
 float Control::getOpacity(State state) const
 float Control::getOpacity(State state) const
@@ -543,10 +574,11 @@ void Control::setEnabled(bool enabled)
     if (_enabled != enabled)
     if (_enabled != enabled)
     {
     {
         _enabled = enabled;
         _enabled = enabled;
-        _dirty = true;
 
 
         if (!_enabled)
         if (!_enabled)
             Form::controlDisabled(this);
             Form::controlDisabled(this);
+
+        setDirty(DIRTY_STATE);
     }
     }
 }
 }
 
 
@@ -574,11 +606,11 @@ void Control::setBorder(float top, float bottom, float left, float right, unsign
 
 
     for (int i = 0; i < Theme::Style::OVERLAY_MAX; ++i)
     for (int i = 0; i < Theme::Style::OVERLAY_MAX; ++i)
     {
     {
-        if( overlays[i] )
+        if (overlays[i])
             overlays[i]->setBorder(top, bottom, left, right);
             overlays[i]->setBorder(top, bottom, left, right);
     }
     }
 
 
-    _dirty = true;
+    setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 const Theme::Border& Control::getBorder(State state) const
 const Theme::Border& Control::getBorder(State state) const
@@ -599,7 +631,6 @@ void Control::setSkinRegion(const Rectangle& region, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setSkinRegion(region, _style->_tw, _style->_th);
             overlays[i]->setSkinRegion(region, _style->_tw, _style->_th);
     }
     }
-    _dirty = true;
 }
 }
 
 
 const Rectangle& Control::getSkinRegion(State state) const
 const Rectangle& Control::getSkinRegion(State state) const
@@ -620,8 +651,6 @@ void Control::setSkinColor(const Vector4& color, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setSkinColor(color);
             overlays[i]->setSkinColor(color);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Vector4& Control::getSkinColor(State state) const
 const Vector4& Control::getSkinColor(State state) const
@@ -636,7 +665,7 @@ void Control::setMargin(float top, float bottom, float left, float right)
     GP_ASSERT(_style);
     GP_ASSERT(_style);
     overrideStyle();
     overrideStyle();
     _style->setMargin(top, bottom, left, right);
     _style->setMargin(top, bottom, left, right);
-    _dirty = true;
+    setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 const Theme::Margin& Control::getMargin() const
 const Theme::Margin& Control::getMargin() const
@@ -650,7 +679,7 @@ void Control::setPadding(float top, float bottom, float left, float right)
     GP_ASSERT(_style);
     GP_ASSERT(_style);
     overrideStyle();
     overrideStyle();
     _style->setPadding(top, bottom, left, right);
     _style->setPadding(top, bottom, left, right);
-    _dirty = true;
+    setDirty(DIRTY_BOUNDS);
 }
 }
     
     
 const Theme::Padding& Control::getPadding() const
 const Theme::Padding& Control::getPadding() const
@@ -670,8 +699,6 @@ void Control::setImageRegion(const char* id, const Rectangle& region, unsigned c
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setImageRegion(id, region, _style->_tw, _style->_th);
             overlays[i]->setImageRegion(id, region, _style->_tw, _style->_th);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Rectangle& Control::getImageRegion(const char* id, State state) const
 const Rectangle& Control::getImageRegion(const char* id, State state) const
@@ -692,8 +719,6 @@ void Control::setImageColor(const char* id, const Vector4& color, unsigned char
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setImageColor(id, color);
             overlays[i]->setImageColor(id, color);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Vector4& Control::getImageColor(const char* id, State state) const
 const Vector4& Control::getImageColor(const char* id, State state) const
@@ -721,8 +746,6 @@ void Control::setCursorRegion(const Rectangle& region, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setCursorRegion(region, _style->_tw, _style->_th);
             overlays[i]->setCursorRegion(region, _style->_tw, _style->_th);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Rectangle& Control::getCursorRegion(State state) const
 const Rectangle& Control::getCursorRegion(State state) const
@@ -743,8 +766,6 @@ void Control::setCursorColor(const Vector4& color, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setCursorColor(color);
             overlays[i]->setCursorColor(color);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Vector4& Control::getCursorColor(State state)
 const Vector4& Control::getCursorColor(State state)
@@ -773,7 +794,8 @@ void Control::setFont(Font* font, unsigned char states)
             overlays[i]->setFont(font);
             overlays[i]->setFont(font);
     }
     }
 
 
-    _dirty = true;
+    if (_autoSize != AUTO_SIZE_NONE)
+        setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 Font* Control::getFont(State state) const
 Font* Control::getFont(State state) const
@@ -795,7 +817,8 @@ void Control::setFontSize(unsigned int fontSize, unsigned char states)
             overlays[i]->setFontSize(fontSize);
             overlays[i]->setFontSize(fontSize);
     }
     }
 
 
-    _dirty = true;
+    if (_autoSize != AUTO_SIZE_NONE)
+        setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 unsigned int Control::getFontSize(State state) const
 unsigned int Control::getFontSize(State state) const
@@ -816,8 +839,6 @@ void Control::setTextColor(const Vector4& color, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setTextColor(color);
             overlays[i]->setTextColor(color);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 const Vector4& Control::getTextColor(State state) const
 const Vector4& Control::getTextColor(State state) const
@@ -838,8 +859,6 @@ void Control::setTextAlignment(Font::Justify alignment, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setTextAlignment(alignment);
             overlays[i]->setTextAlignment(alignment);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 Font::Justify Control::getTextAlignment(State state) const
 Font::Justify Control::getTextAlignment(State state) const
@@ -860,8 +879,6 @@ void Control::setTextRightToLeft(bool rightToLeft, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setTextRightToLeft(rightToLeft);
             overlays[i]->setTextRightToLeft(rightToLeft);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 bool Control::getTextRightToLeft(State state) const
 bool Control::getTextRightToLeft(State state) const
@@ -880,10 +897,9 @@ void Control::setStyle(Theme::Style* style)
 {
 {
     if (style != _style)
     if (style != _style)
     {
     {
-        _dirty = true;
+        _style = style;
+        setDirty(DIRTY_BOUNDS);
     }
     }
-
-    _style = style;
 }
 }
 
 
 Theme* Control::getTheme() const
 Theme* Control::getTheme() const
@@ -904,7 +920,7 @@ Control::State Control::getState() const
             return FOCUS;
             return FOCUS;
         return Form::_activeControlState;
         return Form::_activeControlState;
     }
     }
-    
+
     if (Form::_focusControl == this)
     if (Form::_focusControl == this)
         return FOCUS;
         return FOCUS;
 
 
@@ -950,7 +966,6 @@ void Control::setZIndex(int zIndex)
     if (zIndex != _zIndex)
     if (zIndex != _zIndex)
     {
     {
         _zIndex = zIndex;
         _zIndex = zIndex;
-        _dirty = true;
 
 
         if (_parent)
         if (_parent)
         {
         {
@@ -1044,12 +1059,12 @@ void Control::addSpecificListener(Control::Listener* listener, Control::Listener
 
 
 bool Control::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 bool Control::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
 {
-    return false;// _consumeInputEvents;
+    return false;
 }
 }
 
 
 bool Control::keyEvent(Keyboard::KeyEvent evt, int key)
 bool Control::keyEvent(Keyboard::KeyEvent evt, int key)
 {
 {
-    return false;// _consumeInputEvents;
+    return false;
 }
 }
 
 
 bool Control::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
 bool Control::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
@@ -1061,7 +1076,7 @@ bool Control::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
 
 
 bool Control::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex)
 bool Control::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex)
 {
 {
-    return false;// _consumeInputEvents;
+    return false;
 }
 }
 
 
 void Control::notifyListeners(Control::Listener::EventType eventType)
 void Control::notifyListeners(Control::Listener::EventType eventType)
@@ -1096,23 +1111,90 @@ void Control::controlEvent(Control::Listener::EventType evt)
 {
 {
 }
 }
 
 
-void Control::update(const Control* container, const Vector2& offset)
+void Control::setDirty(int bits)
 {
 {
-    Game* game = Game::getInstance();
+    _dirtyBits |= bits;
+}
 
 
-    const Rectangle parentAbsoluteBounds = container ? container->_viewportBounds : Rectangle(0, 0, game->getViewport().width, game->getViewport().height);
-    const Rectangle parentAbsoluteClip = container ? container->_viewportClipBounds : parentAbsoluteBounds;
+bool Control::isDirty(int bit) const
+{
+    return (_dirtyBits & bit) == bit;
+}
 
 
-    const Theme::Border& border = getBorder(getState());
-    const Theme::Padding& padding = getPadding();
+void Control::update(float elapsedTime)
+{
+    State state = getState();
 
 
-    // Compute content are padding values
-    float lpadding = border.left + padding.left;
-    float rpadding = border.right + padding.right;
-    float tpadding = border.top + padding.top;
-    float bpadding = border.bottom + padding.bottom;
-    float hpadding = lpadding + rpadding;
-    float vpadding = tpadding + bpadding;
+    // Update visual state if it's dirty
+    if (_dirtyBits & DIRTY_STATE)
+        updateState(getState());
+
+    // Since opacity is pre-multiplied, we compute it every frame so that we don't need to
+    // dirty the entire hierarchy any time a state changes (which could affect opacity).
+    _opacity = getOpacity(state);
+    if (_parent)
+        _opacity *= _parent->_opacity;
+}
+
+void Control::updateState(State state)
+{
+    // Clear dirty state bit
+    _dirtyBits &= ~DIRTY_STATE;
+
+    // Cache themed attributes for performance.
+    _skin = getSkin(state);
+}
+
+bool Control::updateBoundsInternal(const Vector2& offset)
+{
+    // If our state is currently dirty, update it here so that any rendering state objects needed
+    // for bounds computation are accessible.
+    State state = getState();
+    if (_dirtyBits & DIRTY_STATE)
+    {
+        updateState(state);
+        _dirtyBits &= ~DIRTY_STATE;
+    }
+
+    // Clear our dirty bounds bit
+    bool dirtyBounds = (_dirtyBits & DIRTY_BOUNDS) != 0;
+    _dirtyBits &= ~DIRTY_BOUNDS;
+
+    // If we are a container, always update child bounds first
+    bool changed = false;
+    if (isContainer())
+        changed = static_cast<Container*>(this)->updateChildBounds();
+
+    if (dirtyBounds)
+    {
+        // Store old bounds so we can determine if they change
+        Rectangle oldAbsoluteBounds(_absoluteBounds);
+        Rectangle oldAbsoluteClipBounds(_absoluteClipBounds);
+        Rectangle oldViewportBounds(_viewportBounds);
+        Rectangle oldViewportClipBounds(_viewportClipBounds);
+
+        updateBounds();
+        updateAbsoluteBounds(offset);
+
+        if (_absoluteBounds != oldAbsoluteBounds ||
+            _absoluteClipBounds != oldAbsoluteClipBounds ||
+            _viewportBounds != oldViewportBounds ||
+            _viewportClipBounds != oldViewportClipBounds)
+        {
+            if (isContainer())
+                static_cast<Container*>(this)->setChildrenDirty(DIRTY_BOUNDS, true);
+            changed = true;
+        }
+    }
+
+    return changed;
+}
+
+void Control::updateBounds()
+{
+    Game* game = Game::getInstance();
+
+    const Rectangle parentAbsoluteBounds = _parent ? _parent->_viewportBounds : Rectangle(0, 0, game->getViewport().width, game->getViewport().height);
 
 
     // Calculate local unclipped bounds.
     // Calculate local unclipped bounds.
     _bounds.set(_relativeBounds);
     _bounds.set(_relativeBounds);
@@ -1120,15 +1202,80 @@ void Control::update(const Control* container, const Vector2& offset)
         _bounds.x *= parentAbsoluteBounds.width;
         _bounds.x *= parentAbsoluteBounds.width;
     if (isYPercentage())
     if (isYPercentage())
         _bounds.y *= parentAbsoluteBounds.height;
         _bounds.y *= parentAbsoluteBounds.height;
-    if (_autoWidth == AUTO_SIZE_STRETCH)
-        _bounds.width = parentAbsoluteBounds.width;
-    else if (isWidthPercentage())
+    if (isWidthPercentage())
         _bounds.width *= parentAbsoluteBounds.width;
         _bounds.width *= parentAbsoluteBounds.width;
-    if (_autoHeight == AUTO_SIZE_STRETCH)
-        _bounds.height = parentAbsoluteBounds.height;
-    else if (isHeightPercentage())
+    if (isHeightPercentage())
         _bounds.height *= parentAbsoluteBounds.height;
         _bounds.height *= parentAbsoluteBounds.height;
 
 
+    // Apply control alignment
+    if (_alignment != Control::ALIGN_TOP_LEFT)
+    {
+        const Theme::Margin& margin = _style->getMargin();
+        const Rectangle& parentBounds = _parent ? _parent->getBounds() : Rectangle(0, 0, game->getViewport().width, game->getViewport().height);
+        const Theme::Border& parentBorder = _parent ? _parent->getBorder(_parent->getState()) : Theme::Border::empty();
+        const Theme::Padding& parentPadding = _parent ? _parent->getPadding() : Theme::Padding::empty();
+
+        float clipWidth, clipHeight;
+        if (_parent && (_parent->getScroll() != Container::SCROLL_NONE))
+        {
+            const Rectangle& verticalScrollBarBounds = _parent->getImageRegion("verticalScrollBar", _parent->getState());
+            const Rectangle& horizontalScrollBarBounds = _parent->getImageRegion("horizontalScrollBar", _parent->getState());
+            clipWidth = parentBounds.width - parentBorder.left - parentBorder.right - parentPadding.left - parentPadding.right - verticalScrollBarBounds.width;
+            clipHeight = parentBounds.height - parentBorder.top - parentBorder.bottom - parentPadding.top - parentPadding.bottom - horizontalScrollBarBounds.height;
+        }
+        else
+        {
+            clipWidth = parentBounds.width - parentBorder.left - parentBorder.right - parentPadding.left - parentPadding.right;
+            clipHeight = parentBounds.height - parentBorder.top - parentBorder.bottom - parentPadding.top - parentPadding.bottom;
+        }
+
+        // Vertical alignment
+        if ((_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)
+        {
+            _bounds.y = clipHeight - _bounds.height - margin.bottom;
+        }
+        else if ((_alignment & Control::ALIGN_VCENTER) == Control::ALIGN_VCENTER)
+        {
+            _bounds.y = clipHeight * 0.5f - _bounds.height * 0.5f;
+        }
+        else if ((_alignment & Control::ALIGN_TOP) == Control::ALIGN_TOP)
+        {
+            _bounds.y = margin.top;
+        }
+
+        // Horizontal alignment
+        if ((_alignment & Control::ALIGN_RIGHT) == Control::ALIGN_RIGHT)
+        {
+            _bounds.x = clipWidth - _bounds.width - margin.right;
+        }
+        else if ((_alignment & Control::ALIGN_HCENTER) == Control::ALIGN_HCENTER)
+        {
+            _bounds.x = clipWidth * 0.5f - _bounds.width * 0.5f;
+        }
+        else if ((_alignment & Control::ALIGN_LEFT) == Control::ALIGN_LEFT)
+        {
+            _bounds.x = margin.left;
+        }
+    }
+}
+
+void Control::updateAbsoluteBounds(const Vector2& offset)
+{
+    Game* game = Game::getInstance();
+
+    const Rectangle parentAbsoluteBounds = _parent ? _parent->_viewportBounds : Rectangle(0, 0, game->getViewport().width, game->getViewport().height);
+    const Rectangle parentAbsoluteClip = _parent ? _parent->_viewportClipBounds : parentAbsoluteBounds;
+
+    // Compute content area padding values
+    const Theme::Border& border = getBorder(NORMAL);
+    const Theme::Padding& padding = getPadding();
+    float lpadding = border.left + padding.left;
+    float rpadding = border.right + padding.right;
+    float tpadding = border.top + padding.top;
+    float bpadding = border.bottom + padding.bottom;
+    float hpadding = lpadding + rpadding;
+    float vpadding = tpadding + bpadding;
+
     // Calculate absolute unclipped bounds
     // Calculate absolute unclipped bounds
     _absoluteBounds.set(
     _absoluteBounds.set(
         parentAbsoluteBounds.x + offset.x + _bounds.x,
         parentAbsoluteBounds.x + offset.x + _bounds.x,
@@ -1156,14 +1303,6 @@ void Control::update(const Control* container, const Vector2& offset)
 
 
     // Calculate the absolute clipped viewport bounds
     // Calculate the absolute clipped viewport bounds
     Rectangle::intersect(_viewportBounds, parentAbsoluteClip, &_viewportClipBounds);
     Rectangle::intersect(_viewportBounds, parentAbsoluteClip, &_viewportClipBounds);
-
-    // Cache themed attributes for performance.
-    _skin = getSkin(getState());
-
-    // Current opacity should be multiplied by that of the parent container.
-    _opacity = getOpacity(getState());
-    if (container)
-        _opacity *= container->_opacity;
 }
 }
 
 
 void Control::startBatch(Form* form, SpriteBatch* batch)
 void Control::startBatch(Form* form, SpriteBatch* batch)
@@ -1293,11 +1432,6 @@ unsigned int Control::drawText(Form* form, const Rectangle& position)
     return 0;
     return 0;
 }
 }
 
 
-bool Control::isDirty()
-{
-    return _dirty;
-}
-
 bool Control::isContainer() const
 bool Control::isContainer() const
 {
 {
     return false;
     return false;
@@ -1636,7 +1770,8 @@ void Control::setImageList(Theme::ImageList* imageList, unsigned char states)
             overlays[i]->setImageList(imageList);
             overlays[i]->setImageList(imageList);
     }
     }
 
 
-    _dirty = true;
+    if (_autoSize != AUTO_SIZE_NONE)
+        setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 void Control::setCursor(Theme::ThemeImage* cursor, unsigned char states)
 void Control::setCursor(Theme::ThemeImage* cursor, unsigned char states)
@@ -1650,8 +1785,6 @@ void Control::setCursor(Theme::ThemeImage* cursor, unsigned char states)
         if( overlays[i] )
         if( overlays[i] )
             overlays[i]->setCursor(cursor);
             overlays[i]->setCursor(cursor);
     }
     }
-
-    _dirty = true;
 }
 }
 
 
 void Control::setSkin(Theme::Skin* skin, unsigned char states)
 void Control::setSkin(Theme::Skin* skin, unsigned char states)
@@ -1666,7 +1799,8 @@ void Control::setSkin(Theme::Skin* skin, unsigned char states)
             overlays[i]->setSkin(skin);
             overlays[i]->setSkin(skin);
     }
     }
 
 
-    _dirty = true;
+    if (_autoSize != AUTO_SIZE_NONE)
+        setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 Theme::Skin* Control::getSkin(State state)
 Theme::Skin* Control::getSkin(State state)

+ 140 - 82
gameplay/src/Control.h

@@ -27,10 +27,6 @@ class Control : public Ref, public AnimationTarget, public ScriptTarget
 {
 {
     friend class Form;
     friend class Form;
     friend class Container;
     friend class Container;
-    friend class Layout;
-    friend class AbsoluteLayout;
-    friend class VerticalLayout;
-    friend class FlowLayout;
 
 
 public:
 public:
 
 
@@ -104,16 +100,19 @@ public:
         AUTO_SIZE_NONE = 0x00,
         AUTO_SIZE_NONE = 0x00,
 
 
         /**
         /**
-         * The control's size is stretched to fill the content area of its parent container.
+         * The control's width is set to tightly fit its contents.
          */
          */
-        AUTO_SIZE_STRETCH = 0x01,
+        AUTO_SIZE_WIDTH = 0x01,
 
 
         /**
         /**
-         * The control's size is set to tightly fit its contents.
-         *
-         * Not all controls support this auto sizing mode.
+        * The control's height is set to tightly fit its contents.
+        */
+        AUTO_SIZE_HEIGHT = 0x02,
+
+        /**
+         * The control's width and height are set to tightly fit its contents.
          */
          */
-        AUTO_SIZE_FIT = 0x02
+        AUTO_SIZE_BOTH = (AUTO_SIZE_WIDTH | AUTO_SIZE_HEIGHT)
     };
     };
 
 
     /**
     /**
@@ -309,7 +308,9 @@ public:
      * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
      * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
      * between 0-1, where 1 equals the full size of it's parent.
      * between 0-1, where 1 equals the full size of it's parent.
      *
      *
-     * @param width The width.
+     * Explicitly setting the width of a control clears the AUTO_SIZE_WIDTH bit, if set.
+     *
+     * @param width The new width.
      * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
      * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
      */
      */
     void setWidth(float width, bool percentage = false);
     void setWidth(float width, bool percentage = false);
@@ -334,7 +335,9 @@ public:
      * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
      * If the value is passed as a percentage of its parent container's clip region, it is interpreted as a value
      * between 0-1, where 1 equals the full size of it's parent.
      * between 0-1, where 1 equals the full size of it's parent.
      *
      *
-     * @param height The height.
+     * Explicitly setting the height of a control clears the AUTO_SIZE_HEIGHT bit, if set.
+     *
+     * @param height The new height.
      * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
      * @param percentage True if the value should be interpreted as a percentage (0-1), false if it is regular number.
      */
      */
     void setHeight(float height, bool percentage = false);
     void setHeight(float height, bool percentage = false);
@@ -365,8 +368,10 @@ public:
      * Setting percetage values is not supported with this method, use setWidth
      * Setting percetage values is not supported with this method, use setWidth
      * and setHeight instead.
      * and setHeight instead.
      *
      *
-     * @param width The width.
-     * @param height The height.
+     * Explicitly setting the size of a control clears the AutoSize bits, if set.
+     *
+     * @param width The new width.
+     * @param height The new height.
      */
      */
     void setSize(float width, float height);
     void setSize(float width, float height);
 
 
@@ -386,6 +391,8 @@ public:
      * Setting percetage values is not supported with this method, use setX,
      * Setting percetage values is not supported with this method, use setX,
      * setY, setWidth and setHeight instead.
      * setY, setWidth and setHeight instead.
      *
      *
+     * Explicitly setting the bounds of a control clears the AutoSize bits, if set.
+     *
      * @param bounds The new bounds to set.
      * @param bounds The new bounds to set.
      */
      */
     void setBounds(const Rectangle& bounds);
     void setBounds(const Rectangle& bounds);
@@ -418,52 +425,18 @@ public:
     const Rectangle& getClip() const;
     const Rectangle& getClip() const;
 
 
     /**
     /**
-     * Returns the auto sizing mode for this control's width.
+     * Returns the auto sizing mode for this control.
      *
      *
-     * @return The auto size mode for this control's width.
+     * @return The auto size mode for this control.
      */
      */
-    AutoSize getAutoWidth() const;
+    AutoSize getAutoSize() const;
 
 
     /**
     /**
-     * Enables or disables auto sizing for this control's width.
+     * Sets the auto size mode for this control.
      *
      *
-     * This method is a simplified version of setAutoWidth(AutoSize) left intact for legacy reasons.
-     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's width.
-     *
-     * @param autoWidth True to enable AUTO_SIZE_STRETCH for this control's width.
-     */
-    void setAutoWidth(bool autoWidth);
-
-    /**
-     * Sets the auto size mode for this control's width.
-     *
-     * @param mode The new auto size mode for this control's width.
+     * @param mode The new auto size mode for this control.
      */
      */
-    void setAutoWidth(AutoSize mode);
-
-    /**
-     * Returns the auto sizing mode for this control's height.
-     *
-     * @return The auto size mode for this control's height.
-     */
-    AutoSize getAutoHeight() const;
-
-    /**
-     * Enables or disables auto sizing for this control's height.
-     *
-     * This method is a simplified version of setAutoHeight(AutoSize) left intact for legacy reasons.
-     * It enables or disables the AUTO_SIZE_STRETCH mode for the control's height.
-     *
-     * @param autoHeight True to enable AUTO_SIZE_STRETCH for this control's height.
-     */
-    void setAutoHeight(bool autoHeight);
-
-    /**
-     * Sets the auto size mode for this control's height.
-     *
-     * @param mode The new auto size mode for this control's height.
-     */
-    void setAutoHeight(AutoSize mode);
+    void setAutoSize(AutoSize mode);
 
 
     /**
     /**
      * Set the alignment of this control within its parent container.
      * Set the alignment of this control within its parent container.
@@ -1002,6 +975,16 @@ protected:
      */
      */
     static const int INVALID_CONTACT_INDEX = -1;
     static const int INVALID_CONTACT_INDEX = -1;
 
 
+    /**
+     * Indicates that the bounds of the control are dirty.
+     */
+    static const int DIRTY_BOUNDS = 1;
+
+    /**
+     * Indicates that the state of the control is dirty.
+     */
+    static const int DIRTY_STATE = 2;
+
     /**
     /**
      * Constructor.
      * Constructor.
      */
      */
@@ -1017,6 +1000,52 @@ protected:
      */
      */
     Control& operator=(const Control&);
     Control& operator=(const Control&);
 
 
+    /**
+     * Internal method for setting the X position of the control.
+     *
+     * This method is meant for internal use by the Control or descendent classes
+     * who need to modify the position of the control during bounds computation.
+     *
+     * @see setX(float, bool)
+     */
+    void setXInternal(float x, bool percentage = false);
+
+    /**
+     * Internal method for setting the Y position of the control.
+     *
+     * This method is meant for internal use by the Control or descendent classes
+     * who need to modify the position of the control during bounds computation.
+     *
+     * @see setY(float, bool)
+     */
+    void setYInternal(float x, bool percentage = false);
+
+    /**
+     * Internal method for setting the width of the control.
+     *
+     * The width of the control is set without modifying the existing AutoSize
+     * rules for the control.
+     *
+     * This method is meant for internal use by the Control or descendent classes
+     * who need to modify the size of the control during bounds computation.
+     *
+     * @see setWidth(float, bool)
+     */
+    void setWidthInternal(float width, bool percentage = false);
+
+    /**
+     * Internal method for setting the height of the control.
+     *
+     * The height of the control is set without modifying the existing AutoSize
+     * rules for the control.
+     *
+     * This method is meant for internal use by the Control or descendent classes
+     * who need to modify the size of the control during bounds computation.
+     *
+     * @see setHeight(float, bool)
+     */
+    void setHeightInternal(float height, bool percentage = false);
+
     /**
     /**
      * Get the overlay type corresponding to this control's current state.
      * Get the overlay type corresponding to this control's current state.
      *
      *
@@ -1076,13 +1105,40 @@ protected:
     virtual bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
     virtual bool gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned int analogIndex);
 
 
     /**
     /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
+     * Called each frame to update this control and its children.
+     *
+     * Any logic that must be performed every frame should be implemented here,
+     * such as custom animation or interpolation that depends on time.
+     * Layout logic should not be implemented here, but in updateBounds instead.
+     *
+     * @param elapsedTime Time since last frame.
+     */
+    virtual void update(float elapsedTime);
+
+    /**
+     * Called when the state of the control has been updated.
+     *
+     * When the state of a control is updated (for example, a control becomes active, focused,
+     * hovered, disabled, etc), this method is called to allow implementations to update
+     * internal data related to control state.
+     *
+     * @param The new control state.
+     */
+    virtual void updateState(State state);
+
+    /**
+     * Updates the local bounds for this control and its children.
      *
      *
-     * @param container This control's parent container.
-     * @param offset Positioning offset to add to the control's position.
+     * Child controls that need to customize their bounds calculation should override this method.
      */
      */
-    virtual void update(const Control* container, const Vector2& offset);
+    virtual void updateBounds();
+
+    /**
+     * Updates the absolute bounds for this control and its children.
+     *
+     * @param offset Offset to add to the control's position (most often used for scrolling).
+     */
+    virtual void updateAbsoluteBounds(const Vector2& offset);
 
 
     /**
     /**
      * Indicates that a control will begin drawing into the specified batch.
      * Indicates that a control will begin drawing into the specified batch.
@@ -1172,13 +1228,6 @@ protected:
      */
      */
     virtual void initialize(const char* typeName, Theme::Style* style, Properties* properties);
     virtual void initialize(const char* typeName, Theme::Style* style, Properties* properties);
 
 
-    /**
-     * Returns whether this control has been modified and requires an update.
-     *
-     * @return Whether this control has been modified and requires an update.
-     */
-    virtual bool isDirty();
-
     /**
     /**
      * Get a Control::State enum from a matching string.
      * Get a Control::State enum from a matching string.
      *
      *
@@ -1213,6 +1262,22 @@ protected:
      */
      */
     virtual void controlEvent(Control::Listener::EventType evt);
     virtual void controlEvent(Control::Listener::EventType evt);
 
 
+    /**
+     * Sets dirty bits for the control.
+     *
+     * Valid bits are any of the "DIRTY_xxx" constants from the Control class.
+     *
+     * @param bits Dirty bits to set.
+     */
+    void setDirty(int bits);
+
+    /**
+     * Determines if the specified bit is dirty.
+     *
+     * @param bit The bit to check.
+     */
+    bool isDirty(int bit) const;
+
     /**
     /**
      * Gets the Alignment by string.
      * Gets the Alignment by string.
      *
      *
@@ -1272,10 +1337,10 @@ protected:
     Rectangle _viewportClipBounds;
     Rectangle _viewportClipBounds;
 
 
     /**
     /**
-     * If the control is dirty and need updating.
+     * Control dirty bits.
      */
      */
-    bool _dirty;
-    
+    int _dirtyBits;
+
     /**
     /**
      * Flag for whether the Control consumes input events.
      * Flag for whether the Control consumes input events.
      */
      */
@@ -1285,26 +1350,15 @@ protected:
      * The Control's Alignment
      * The Control's Alignment
      */
      */
     Alignment _alignment;
     Alignment _alignment;
-
-    /**
-     * Whether the Control's alignment has been set programmatically.
-     */
-    bool _isAlignmentSet;
     
     
     /**
     /**
-     * Whether the Control's width is auto-sized.
+     * The Control's auto size mode.
      */
      */
-    AutoSize _autoWidth;
-    
-    /**
-     * Whether the Control's height is auto-sized.
-     */
-    AutoSize _autoHeight;
+    AutoSize _autoSize;
     
     
     /**
     /**
      * Listeners map of EventType's to a list of Listeners.
      * Listeners map of EventType's to a list of Listeners.
      */
      */
-    //std::map<Listener::EventType, std::list<Listener*>*>* _listeners;
     std::map<Control::Listener::EventType, std::list<Control::Listener*>*>* _listeners;
     std::map<Control::Listener::EventType, std::list<Control::Listener*>*>* _listeners;
     
     
     /**
     /**
@@ -1354,6 +1408,10 @@ private:
      */    
      */    
     Control(const Control& copy);
     Control(const Control& copy);
 
 
+    bool updateBoundsInternal(const Vector2& offset);
+
+    AutoSize Control::parseAutoSize(const char* str);
+
     Theme::Style::Overlay** getOverlays(unsigned char overlayTypes, Theme::Style::Overlay** overlays);
     Theme::Style::Overlay** getOverlays(unsigned char overlayTypes, Theme::Style::Overlay** overlays);
 
 
     Theme::Style::Overlay* getOverlay(Control::State state) const;
     Theme::Style::Overlay* getOverlay(Control::State state) const;

+ 1 - 4
gameplay/src/FlowLayout.cpp

@@ -52,7 +52,7 @@ void FlowLayout::setSpacing(int horizontalSpacing, int verticalSpacing)
     _verticalSpacing = verticalSpacing;
     _verticalSpacing = verticalSpacing;
 }
 }
 
 
-void FlowLayout::update(const Container* container, const Vector2& offset)
+void FlowLayout::update(const Container* container)
 {
 {
     GP_ASSERT(container);
     GP_ASSERT(container);
     const Rectangle& containerBounds = container->getBounds();
     const Rectangle& containerBounds = container->getBounds();
@@ -76,8 +76,6 @@ void FlowLayout::update(const Container* container, const Vector2& offset)
         if (!control->isVisible())
         if (!control->isVisible())
             continue;
             continue;
 
 
-        //align(control, container);
-
         const Rectangle& bounds = control->getBounds();
         const Rectangle& bounds = control->getBounds();
         const Theme::Margin& margin = control->getMargin();
         const Theme::Margin& margin = control->getMargin();
 
 
@@ -94,7 +92,6 @@ void FlowLayout::update(const Container* container, const Vector2& offset)
         yPosition = rowY + margin.top;
         yPosition = rowY + margin.top;
 
 
         control->setPosition(xPosition, yPosition);
         control->setPosition(xPosition, yPosition);
-        control->update(container, offset);
 
 
         xPosition += bounds.width + margin.right + _horizontalSpacing;
         xPosition += bounds.width + margin.right + _horizontalSpacing;
 
 

+ 1 - 2
gameplay/src/FlowLayout.h

@@ -53,9 +53,8 @@ protected:
      * Update the controls contained by the specified container.
      * Update the controls contained by the specified container.
      *
      *
      * @param container The container to update.
      * @param container The container to update.
-     * @param offset The offset position.
      */
      */
-    void update(const Container* container, const Vector2& offset);
+    void update(const Container* container);
 
 
     /**
     /**
      * Horizontal spacing between controls.
      * Horizontal spacing between controls.

+ 16 - 16
gameplay/src/Font.cpp

@@ -1912,69 +1912,69 @@ Font::Justify Font::getJustify(const char* justify)
         return Font::ALIGN_TOP_LEFT;
         return Font::ALIGN_TOP_LEFT;
     }
     }
 
 
-    if (strcmp(justify, "ALIGN_LEFT") == 0)
+    if (strcmpnocase(justify, "ALIGN_LEFT") == 0)
     {
     {
         return Font::ALIGN_LEFT;
         return Font::ALIGN_LEFT;
     }
     }
-    else if (strcmp(justify, "ALIGN_HCENTER") == 0)
+    else if (strcmpnocase(justify, "ALIGN_HCENTER") == 0)
     {
     {
         return Font::ALIGN_HCENTER;
         return Font::ALIGN_HCENTER;
     }
     }
-    else if (strcmp(justify, "ALIGN_RIGHT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_RIGHT") == 0)
     {
     {
         return Font::ALIGN_RIGHT;
         return Font::ALIGN_RIGHT;
     }
     }
-    else if (strcmp(justify, "ALIGN_TOP") == 0)
+    else if (strcmpnocase(justify, "ALIGN_TOP") == 0)
     {
     {
         return Font::ALIGN_TOP;
         return Font::ALIGN_TOP;
     }
     }
-    else if (strcmp(justify, "ALIGN_VCENTER") == 0)
+    else if (strcmpnocase(justify, "ALIGN_VCENTER") == 0)
     {
     {
         return Font::ALIGN_VCENTER;
         return Font::ALIGN_VCENTER;
     }
     }
-    else if (strcmp(justify, "ALIGN_BOTTOM") == 0)
+    else if (strcmpnocase(justify, "ALIGN_BOTTOM") == 0)
     {
     {
         return Font::ALIGN_BOTTOM;
         return Font::ALIGN_BOTTOM;
     }
     }
-    else if (strcmp(justify, "ALIGN_TOP_LEFT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_TOP_LEFT") == 0)
     {
     {
         return Font::ALIGN_TOP_LEFT;
         return Font::ALIGN_TOP_LEFT;
     }
     }
-    else if (strcmp(justify, "ALIGN_VCENTER_LEFT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_VCENTER_LEFT") == 0)
     {
     {
         return Font::ALIGN_VCENTER_LEFT;
         return Font::ALIGN_VCENTER_LEFT;
     }
     }
-    else if (strcmp(justify, "ALIGN_BOTTOM_LEFT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_BOTTOM_LEFT") == 0)
     {
     {
         return Font::ALIGN_BOTTOM_LEFT;
         return Font::ALIGN_BOTTOM_LEFT;
     }
     }
-    else if (strcmp(justify, "ALIGN_TOP_HCENTER") == 0)
+    else if (strcmpnocase(justify, "ALIGN_TOP_HCENTER") == 0)
     {
     {
         return Font::ALIGN_TOP_HCENTER;
         return Font::ALIGN_TOP_HCENTER;
     }
     }
-    else if (strcmp(justify, "ALIGN_VCENTER_HCENTER") == 0)
+    else if (strcmpnocase(justify, "ALIGN_VCENTER_HCENTER") == 0)
     {
     {
         return Font::ALIGN_VCENTER_HCENTER;
         return Font::ALIGN_VCENTER_HCENTER;
     }
     }
-    else if (strcmp(justify, "ALIGN_BOTTOM_HCENTER") == 0)
+    else if (strcmpnocase(justify, "ALIGN_BOTTOM_HCENTER") == 0)
     {
     {
         return Font::ALIGN_BOTTOM_HCENTER;
         return Font::ALIGN_BOTTOM_HCENTER;
     }
     }
-    else if (strcmp(justify, "ALIGN_TOP_RIGHT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_TOP_RIGHT") == 0)
     {
     {
         return Font::ALIGN_TOP_RIGHT;
         return Font::ALIGN_TOP_RIGHT;
     }
     }
-    else if (strcmp(justify, "ALIGN_VCENTER_RIGHT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_VCENTER_RIGHT") == 0)
     {
     {
         return Font::ALIGN_VCENTER_RIGHT;
         return Font::ALIGN_VCENTER_RIGHT;
     }
     }
-    else if (strcmp(justify, "ALIGN_BOTTOM_RIGHT") == 0)
+    else if (strcmpnocase(justify, "ALIGN_BOTTOM_RIGHT") == 0)
     {
     {
         return Font::ALIGN_BOTTOM_RIGHT;
         return Font::ALIGN_BOTTOM_RIGHT;
     }
     }
     else
     else
     {
     {
-        GP_ERROR("Failed to get corresponding font justification for unsupported value '%s'.", justify);
+        GP_WARN("Invalid alignment string: '%s'. Defaulting to ALIGN_TOP_LEFT.", justify);
     }
     }
 
 
     // Default.
     // Default.

+ 54 - 163
gameplay/src/Form.cpp

@@ -21,8 +21,6 @@ static const float GAMEPAD_FOCUS_REPEAT_DELAY = 300.0f;
 #define FORM_VSH "res/shaders/sprite.vert"
 #define FORM_VSH "res/shaders/sprite.vert"
 #define FORM_FSH "res/shaders/sprite.frag"
 #define FORM_FSH "res/shaders/sprite.frag"
 
 
-//#define GAMEPLAY_FORMS_USE_FRAMEBUFFER
-
 namespace gameplay
 namespace gameplay
 {
 {
 
 
@@ -32,15 +30,12 @@ Control* Form::_activeControl = NULL;
 Control::State Form::_activeControlState = Control::NORMAL;
 Control::State Form::_activeControlState = Control::NORMAL;
 static bool _shiftKeyDown = false;
 static bool _shiftKeyDown = false;
 
 
-Form::Form() : _node(NULL), _frameBuffer(NULL), _model(NULL), _batched(true)
+Form::Form() : _node(NULL), _batched(true)
 {
 {
 }
 }
 
 
 Form::~Form()
 Form::~Form()
 {
 {
-    SAFE_RELEASE(_model);
-    SAFE_RELEASE(_frameBuffer);
-
     // Remove this Form from the global list.
     // Remove this Form from the global list.
     std::vector<Form*>::iterator it = std::find(__forms.begin(), __forms.end(), this);
     std::vector<Form*>::iterator it = std::find(__forms.begin(), __forms.end(), this);
     if (it != __forms.end())
     if (it != __forms.end())
@@ -78,16 +73,21 @@ Form* Form::create(const char* url)
         if (formProperties->getPath("theme", &themeFile))
         if (formProperties->getPath("theme", &themeFile))
         {
         {
             theme = Theme::create(themeFile.c_str());
             theme = Theme::create(themeFile.c_str());
-            if (theme)
-            {
-                // Load the form's style
-                const char* styleName = formProperties->getString("style", "Form");
-                style = theme->getStyle(styleName);
-                if (!style)
-                    style = theme->getEmptyStyle();
-            }
         }
         }
     }
     }
+    if (!theme)
+    {
+        theme = Theme::getDefault();
+    }
+
+    if (theme)
+    {
+        // Load the form's style
+        const char* styleName = formProperties->getString("style", "Form");
+        style = theme->getStyle(styleName);
+        if (!style)
+            style = theme->getEmptyStyle();
+    }
 
 
     form->_batched = formProperties->getBool("batchingEnabled", true);
     form->_batched = formProperties->getBool("batchingEnabled", true);
 
 
@@ -95,7 +95,10 @@ Form* Form::create(const char* url)
     form->initialize("Form", style, formProperties);
     form->initialize("Form", style, formProperties);
 
 
     // Release the theme: its lifetime is controlled by addRef() and release() calls in initialize (above) and ~Control.
     // Release the theme: its lifetime is controlled by addRef() and release() calls in initialize (above) and ~Control.
-    SAFE_RELEASE(theme);
+    if (theme != Theme::getDefault())
+    {
+        SAFE_RELEASE(theme);
+    }
 
 
     SAFE_DELETE(properties);
     SAFE_DELETE(properties);
 
 
@@ -116,6 +119,11 @@ void Form::initialize(const char* typeName, Theme::Style* style, Properties* pro
     Container::initialize(typeName, style, properties);
     Container::initialize(typeName, style, properties);
 
 
     __forms.push_back(this);
     __forms.push_back(this);
+
+    // After creation, update our bounds once so code that runs immediately after form
+    // creation has access to up-to-date bounds.
+    if (updateBoundsInternal(Vector2::zero()))
+        updateBoundsInternal(Vector2::zero());
 }
 }
 
 
 Form* Form::getForm(const char* id)
 Form* Form::getForm(const char* id)
@@ -157,8 +165,6 @@ void Form::setNode(Node* node)
     if (_node != node)
     if (_node != node)
     {
     {
         _node = node;
         _node = node;
-
-        updateFrameBuffer();
     }
     }
 }
 }
 
 
@@ -178,99 +184,15 @@ static unsigned int nextPowerOfTwo(unsigned int v)
     return v;
     return v;
 }
 }
 
 
-void Form::updateFrameBuffer()
-{
-    SAFE_RELEASE(_model);
-    SAFE_RELEASE(_frameBuffer);
-
-#ifdef GAMEPLAY_FORMS_USE_FRAMEBUFFER
-
-    if (_node && _absoluteClipBounds.width > 0 && _absoluteClipBounds.height > 0)
-    {
-        // Create an offscreen buffer to draw our form into
-        unsigned int width = nextPowerOfTwo(_absoluteClipBounds.width);
-        unsigned int height = nextPowerOfTwo(_absoluteClipBounds.height);
-
-        _frameBuffer = FrameBuffer::create(_id.c_str(), width, height);
-
-        // Create a model (quad) to draw our offscreen buffer onto
-        float x2 = _absoluteClipBounds.width;
-        float y2 = _absoluteClipBounds.height;
-        float u2 = x2 / width;
-        float v1 = y2 / height;
-        float vertices[] =
-        {
-            0, y2, 0, 0, v1, 1, 1, 1, 1,
-            0, 0, 0, 0, 0, 1, 1, 1, 1,
-            x2, y2, 0, u2, v1, 1, 1, 1, 1,
-            x2, 0, 0, u2, 0, 1, 1, 1, 1
-        };
-        VertexFormat::Element elements[] =
-        {
-            VertexFormat::Element(VertexFormat::POSITION, 3),
-            VertexFormat::Element(VertexFormat::TEXCOORD0, 2),
-            VertexFormat::Element(VertexFormat::COLOR, 4)
-        };
-        Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 3), 4, false);
-        GP_ASSERT(mesh);
-        mesh->setPrimitiveType(Mesh::TRIANGLE_STRIP);
-        mesh->setVertexData(vertices, 0, 4);
-
-        _model = Model::create(mesh);
-        SAFE_RELEASE(mesh);
-
-        Material* material = _model->setMaterial(FORM_VSH, FORM_FSH);
-        material->getParameter("u_projectionMatrix")->bindValue(this, &Form::getProjectionMatrix);
-
-        Texture::Sampler* sampler = Texture::Sampler::create(_frameBuffer->getRenderTarget()->getTexture());
-        sampler->setWrapMode(Texture::CLAMP, Texture::CLAMP);
-        material->getParameter("u_texture")->setSampler(sampler);
-        sampler->release();
-
-        material->getStateBlock()->setDepthWrite(true);
-        material->getStateBlock()->setBlend(true);
-        material->getStateBlock()->setBlendSrc(RenderState::BLEND_SRC_ALPHA);
-        material->getStateBlock()->setBlendDst(RenderState::BLEND_ONE_MINUS_SRC_ALPHA);
-    }
-
-#endif
-}
-
 void Form::update(float elapsedTime)
 void Form::update(float elapsedTime)
 {
 {
-    update(NULL, Vector2::zero());
+    Container::update(elapsedTime);
 
 
-    Control::State state = getState();
-
-    // Cache themed attributes for performance.
-    _skin = getSkin(state);
-    _opacity = getOpacity(state);
-
-    GP_ASSERT(_layout);
-    if (_scroll != SCROLL_NONE)
-    {
-        updateScroll();
-    }
-    else
-    {
-        _layout->update(this, Vector2::zero());
-    }
-}
-
-void Form::update(const Control* container, const Vector2& offset)
-{
-    // Store previous absolute bounds
-    Rectangle oldAbsoluteClipBounds = _absoluteClipBounds;
-
-    Container::update(container, offset);
-
-    _layout->align(this, NULL);
-
-    if (_absoluteClipBounds != oldAbsoluteClipBounds)
-    {
-        if (_node)
-            updateFrameBuffer();
-    }
+    // Do a two-pass bounds update:
+    //  1. First pass updates leaf controls
+    //  2. Second pass updates parent controls that depend on child sizes
+    if (updateBoundsInternal(Vector2::zero()))
+        updateBoundsInternal(Vector2::zero());
 }
 }
 
 
 void Form::startBatch(SpriteBatch* batch)
 void Form::startBatch(SpriteBatch* batch)
@@ -307,40 +229,24 @@ unsigned int Form::draw()
     Game* game = Game::getInstance();
     Game* game = Game::getInstance();
     Rectangle viewport = game->getViewport();
     Rectangle viewport = game->getViewport();
 
 
-    FrameBuffer* oldFrameBuffer = NULL;
-    if (_frameBuffer)
+    // If we're drawing in 2D (i.e. not attached to a node), we need to clear the depth buffer
+    if (_node)
     {
     {
-        // Update the viewport
-        game->setViewport(Rectangle(0, 0, _absoluteClipBounds.width, _absoluteClipBounds.height));
-
-        // Bind the offscreen buffer and clear its color and depth.
-        oldFrameBuffer = _frameBuffer->bind();
-        Game::getInstance()->clear(Game::CLEAR_COLOR_DEPTH, Vector4::zero(), 1, 0);
-
-        // Setup an ortho matrix the maps to the size of the form
-        Matrix::createOrthographicOffCenter(0, _absoluteClipBounds.width, _absoluteClipBounds.height, 0, 0, 1, &_projectionMatrix);
+        // Drawing in 3D.
+        // Setup a projection matrix for drawing the form via the node's world transform.
+        Matrix world(_node->getWorldMatrix());
+        world.scale(1, -1, 1);
+        world.translate(0, -_absoluteClipBounds.height, 0);
+        Matrix::multiply(_node->getViewProjectionMatrix(), world, &_projectionMatrix);
     }
     }
     else
     else
     {
     {
-        // If we're drawing in 2D (i.e. not attached to a node), we need to clear the depth buffer
-        if (_node)
-        {
-            // Drawing in 3D.
-            // Setup a projection matrix for drawing the form via the node's world transform.
-            Matrix world(_node->getWorldMatrix());
-            world.scale(1, -1, 1);
-            world.translate(0, -_absoluteClipBounds.height, 0);
-            Matrix::multiply(_node->getViewProjectionMatrix(), world, &_projectionMatrix);
-        }
-        else
-        {
-            // Drawing in 2D, so we need to clear the depth buffer
-            Game::getInstance()->clear(Game::CLEAR_DEPTH, Vector4::zero(), 1, 0);
+        // Drawing in 2D, so we need to clear the depth buffer
+        Game::getInstance()->clear(Game::CLEAR_DEPTH, Vector4::zero(), 1, 0);
 
 
-            // Setup an ortho matrix that maps to the current viewport
-            const Rectangle& viewport = Game::getInstance()->getViewport();
-            Matrix::createOrthographicOffCenter(0, viewport.width, viewport.height, 0, 0, 1, &_projectionMatrix);
-        }
+        // Setup an ortho matrix that maps to the current viewport
+        const Rectangle& viewport = Game::getInstance()->getViewport();
+        Matrix::createOrthographicOffCenter(0, viewport.width, viewport.height, 0, 0, 1, &_projectionMatrix);
     }
     }
 
 
     // Draw the form
     // Draw the form
@@ -356,21 +262,6 @@ unsigned int Form::draw()
         drawCalls = batchCount;
         drawCalls = batchCount;
     }
     }
 
 
-    // If the form was drawn into an offscreen buffer, we need to now draw that buffer
-    // using the WVP matrix of the node we're attached to.
-    if (oldFrameBuffer)
-    {
-        game->setViewport(viewport);
-        oldFrameBuffer->bind();
-
-        if (_model)
-        {
-            _projectionMatrix = _node->getWorldViewProjectionMatrix();
-            _model->draw();
-            ++drawCalls;
-        }
-    }
-
     return drawCalls;
     return drawCalls;
 }
 }
 
 
@@ -510,11 +401,11 @@ Control* Form::handlePointerPressRelease(int* x, int* y, bool pressed)
             if (_activeControl != ctrl || _activeControlState != Control::ACTIVE)
             if (_activeControl != ctrl || _activeControlState != Control::ACTIVE)
             {
             {
                 if (_activeControl)
                 if (_activeControl)
-                    _activeControl->_dirty = true;
+                    _activeControl->setDirty(Control::DIRTY_STATE);
 
 
                 _activeControl = ctrl;
                 _activeControl = ctrl;
                 _activeControlState = Control::ACTIVE;
                 _activeControlState = Control::ACTIVE;
-                _activeControl->_dirty = true;
+                _activeControl->setDirty(Control::DIRTY_STATE);
             }
             }
 
 
             ctrl->notifyListeners(Control::Listener::PRESS);
             ctrl->notifyListeners(Control::Listener::PRESS);
@@ -535,7 +426,7 @@ Control* Form::handlePointerPressRelease(int* x, int* y, bool pressed)
             screenToForm(ctrl, &newX, &newY);
             screenToForm(ctrl, &newX, &newY);
 
 
             // No longer any active control
             // No longer any active control
-            _activeControl->_dirty = true;
+            _activeControl->setDirty(Control::DIRTY_STATE);
             _activeControl = NULL;
             _activeControl = NULL;
             _activeControlState = Control::NORMAL;
             _activeControlState = Control::NORMAL;
         }
         }
@@ -550,18 +441,18 @@ Control* Form::handlePointerPressRelease(int* x, int* y, bool pressed)
                 if (_activeControl != ctrl || _activeControlState != Control::HOVER)
                 if (_activeControl != ctrl || _activeControlState != Control::HOVER)
                 {
                 {
                     if (_activeControl)
                     if (_activeControl)
-                        _activeControl->_dirty = true;
+                        _activeControl->setDirty(Control::DIRTY_STATE);
 
 
                     _activeControl = ctrl;
                     _activeControl = ctrl;
                     _activeControlState = Control::HOVER;
                     _activeControlState = Control::HOVER;
-                    _activeControl->_dirty = true;
+                    _activeControl->setDirty(Control::DIRTY_STATE);
                 }
                 }
             }
             }
             else
             else
             {
             {
                 // No longer any active control
                 // No longer any active control
                 if (_activeControl)
                 if (_activeControl)
-                    _activeControl->_dirty = true;
+                    _activeControl->setDirty(Control::DIRTY_STATE);
 
 
                 _activeControl = NULL;
                 _activeControl = NULL;
                 _activeControlState = Control::NORMAL;
                 _activeControlState = Control::NORMAL;
@@ -613,18 +504,18 @@ Control* Form::handlePointerMove(int* x, int* y)
             if (_activeControl != ctrl || _activeControlState != Control::HOVER)
             if (_activeControl != ctrl || _activeControlState != Control::HOVER)
             {
             {
                 if (_activeControl)
                 if (_activeControl)
-                    _activeControl->_dirty = true;
+                    _activeControl->setDirty(Control::DIRTY_STATE);
 
 
                 _activeControl = ctrl;
                 _activeControl = ctrl;
                 _activeControlState = Control::HOVER;
                 _activeControlState = Control::HOVER;
-                _activeControl->_dirty = true;
+                _activeControl->setDirty(Control::DIRTY_STATE);
             }
             }
         }
         }
         else
         else
         {
         {
             // No active/hover control
             // No active/hover control
             if (_activeControl)
             if (_activeControl)
-                _activeControl->_dirty = true;
+                _activeControl->setDirty(Control::DIRTY_STATE);
 
 
             _activeControl = NULL;
             _activeControl = NULL;
             _activeControlState = Control::NORMAL;
             _activeControlState = Control::NORMAL;
@@ -1026,7 +917,7 @@ void Form::resizeEventInternal(unsigned int width, unsigned int height)
         if (form)
         if (form)
         {
         {
             // Dirty the form
             // Dirty the form
-            form->_dirty = true;
+            form->setDirty(Control::DIRTY_STATE);
         }
         }
     }
     }
 }
 }
@@ -1101,14 +992,14 @@ void Form::setFocusControl(Control* control)
     // Deactivate the old focus control
     // Deactivate the old focus control
     if (oldFocus)
     if (oldFocus)
     {
     {
-        oldFocus->_dirty = true;
+        oldFocus->setDirty(Control::DIRTY_STATE);
         oldFocus->notifyListeners(Control::Listener::FOCUS_LOST);
         oldFocus->notifyListeners(Control::Listener::FOCUS_LOST);
     }
     }
 
 
     // Activate the new focus control
     // Activate the new focus control
     if (_focusControl)
     if (_focusControl)
     {
     {
-        _focusControl->_dirty = true;
+        _focusControl->setDirty(Control::DIRTY_STATE);
         _focusControl->notifyListeners(Control::Listener::FOCUS_GAINED);
         _focusControl->notifyListeners(Control::Listener::FOCUS_GAINED);
 
 
         // Set the activeControl property of the control's parent container
         // Set the activeControl property of the control's parent container

+ 1 - 15
gameplay/src/Form.h

@@ -102,7 +102,7 @@ public:
     void setNode(Node* node);
     void setNode(Node* node);
 
 
     /**
     /**
-     * Updates each control within this form, and positions them according to its layout.
+     * @see Control::update
      */
      */
     void update(float elapsedTime);
     void update(float elapsedTime);
 
 
@@ -137,13 +137,6 @@ public:
      */
      */
     void setBatchingEnabled(bool enabled);
     void setBatchingEnabled(bool enabled);
 
 
-protected:
-
-    /**
-     * @see Control::update
-     */
-    void update(const Control* container, const Vector2& offset);
-
 private:
 private:
     
     
     /**
     /**
@@ -216,11 +209,6 @@ private:
      */
      */
     static void resizeEventInternal(unsigned int width, unsigned int height);
     static void resizeEventInternal(unsigned int width, unsigned int height);
 
 
-    /**
-     * Called to update internal framebuffer when forms are attached to a node.
-     */
-    void updateFrameBuffer();
-
     /**
     /**
      * Called during drawing to prepare a sprite batch for being drawn into for this form.
      * Called during drawing to prepare a sprite batch for being drawn into for this form.
      */
      */
@@ -267,8 +255,6 @@ private:
     static bool pollGamepad(Gamepad* gamepad);
     static bool pollGamepad(Gamepad* gamepad);
 
 
     Node* _node;                        // Node for transforming this Form in world-space.
     Node* _node;                        // Node for transforming this Form in world-space.
-    FrameBuffer* _frameBuffer;          // FrameBuffer for offscreen drawing of forms that are attached to a Node
-    Model* _model;                      // Model used to render form in 3D when attached to a Node
     Matrix _projectionMatrix;           // Projection matrix to be set on SpriteBatch objects when rendering the form
     Matrix _projectionMatrix;           // Projection matrix to be set on SpriteBatch objects when rendering the form
     std::vector<SpriteBatch*> _batches;
     std::vector<SpriteBatch*> _batches;
     bool _batched;
     bool _batched;

+ 10 - 12
gameplay/src/ImageControl.cpp

@@ -66,7 +66,9 @@ void ImageControl::setImage(const char* path)
     _tw = 1.0f / texture->getWidth();
     _tw = 1.0f / texture->getWidth();
     _th = 1.0f / texture->getHeight();
     _th = 1.0f / texture->getHeight();
     texture->release();
     texture->release();
-    _dirty = true;
+
+    if (_autoSize != AUTO_SIZE_NONE)
+        setDirty(DIRTY_BOUNDS);
 }
 }
 
 
 void ImageControl::setRegionSrc(float x, float y, float width, float height)
 void ImageControl::setRegionSrc(float x, float y, float width, float height)
@@ -77,13 +79,11 @@ void ImageControl::setRegionSrc(float x, float y, float width, float height)
     _uvs.u2 = (x + width) * _tw;
     _uvs.u2 = (x + width) * _tw;
     _uvs.v1 = 1.0f - (y * _th);
     _uvs.v1 = 1.0f - (y * _th);
     _uvs.v2 = 1.0f - ((y + height) * _th);
     _uvs.v2 = 1.0f - ((y + height) * _th);
-    _dirty = true;
 }
 }
 
 
 void ImageControl::setRegionSrc(const Rectangle& region)
 void ImageControl::setRegionSrc(const Rectangle& region)
 {
 {
     setRegionSrc(region.x, region.y, region.width, region.height);
     setRegionSrc(region.x, region.y, region.width, region.height);
-    _dirty = true;
 }
 }
 
 
 const Rectangle& ImageControl::getRegionSrc() const
 const Rectangle& ImageControl::getRegionSrc() const
@@ -94,13 +94,11 @@ const Rectangle& ImageControl::getRegionSrc() const
 void ImageControl::setRegionDst(float x, float y, float width, float height)
 void ImageControl::setRegionDst(float x, float y, float width, float height)
 {
 {
     _dstRegion.set(x, y, width, height);
     _dstRegion.set(x, y, width, height);
-    _dirty = true;
 }
 }
 
 
 void ImageControl::setRegionDst(const Rectangle& region)
 void ImageControl::setRegionDst(const Rectangle& region)
 {
 {
     setRegionDst(region.x, region.y, region.width, region.height);
     setRegionDst(region.x, region.y, region.width, region.height);
-    _dirty = true;
 }
 }
 
 
 const Rectangle& ImageControl::getRegionDst() const
 const Rectangle& ImageControl::getRegionDst() const
@@ -140,22 +138,22 @@ unsigned int ImageControl::drawImages(Form* form, const Rectangle& clip)
     return 1;
     return 1;
 }
 }
 
 
-void ImageControl::update(const Control* container, const Vector2& offset)
+void ImageControl::updateBounds()
 {
 {
-    Control::update(container, offset);
-
     if (_batch)
     if (_batch)
     {
     {
-        if (_autoWidth == Control::AUTO_SIZE_FIT)
+        if (_autoSize & AUTO_SIZE_WIDTH)
         {
         {
-            setWidth(_batch->getSampler()->getTexture()->getWidth());
+            setWidthInternal(_batch->getSampler()->getTexture()->getWidth());
         }
         }
 
 
-        if (_autoHeight == Control::AUTO_SIZE_FIT)
+        if (_autoSize & AUTO_SIZE_HEIGHT)
         {
         {
-            setHeight(_batch->getSampler()->getTexture()->getWidth());
+            setHeightInternal(_batch->getSampler()->getTexture()->getWidth());
         }
         }
     }
     }
+
+    Control::updateBounds();
 }
 }
 
 
 }
 }

+ 2 - 2
gameplay/src/ImageControl.h

@@ -122,9 +122,9 @@ protected:
     unsigned int drawImages(Form* form, const Rectangle& clip);
     unsigned int drawImages(Form* form, const Rectangle& clip);
 
 
     /**
     /**
-     * @see Control#update(const Control*, const Vector2&)
+     * @see Control::updateBounds
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateBounds();
 
 
 private:
 private:
 
 

+ 0 - 3
gameplay/src/JoystickControl.cpp

@@ -221,7 +221,6 @@ bool JoystickControl::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned i
                 if (_value != value)
                 if (_value != value)
                 {
                 {
                     _value.set(value);
                     _value.set(value);
-                    _dirty = true;
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
                 }
 
 
@@ -256,7 +255,6 @@ bool JoystickControl::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned i
                 if (_value != value)
                 if (_value != value)
                 {
                 {
                     _value.set(value);
                     _value.set(value);
-                    _dirty = true;
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
                 }
 
 
@@ -277,7 +275,6 @@ bool JoystickControl::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned i
                 if (_value != value)
                 if (_value != value)
                 {
                 {
                     _value.set(value);
                     _value.set(value);
-                    _dirty = true;
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                     notifyListeners(Control::Listener::VALUE_CHANGED);
                 }
                 }
 
 

+ 39 - 18
gameplay/src/Label.cpp

@@ -57,12 +57,11 @@ void Label::addListener(Control::Listener* listener, int eventFlags)
     
     
 void Label::setText(const char* text)
 void Label::setText(const char* text)
 {
 {
-    assert(text);
-
-    if (strcmp(text, _text.c_str()) != 0)
+    if ((text == NULL && _text.length() > 0) || strcmp(text, _text.c_str()) != 0)
     {
     {
-        _text = text;
-        _dirty = true;
+        _text = text ? text : "";
+        if (_autoSize != AUTO_SIZE_NONE)
+            setDirty(DIRTY_BOUNDS);
     }
     }
 }
 }
 
 
@@ -71,29 +70,51 @@ const char* Label::getText()
     return _text.c_str();
     return _text.c_str();
 }
 }
 
 
-void Label::update(const Control* container, const Vector2& offset)
+void Label::update(float elapsedTime)
 {
 {
-    Control::update(container, offset);
+    Control::update(elapsedTime);
 
 
-    _textBounds.set((int)_viewportBounds.x, (int)_viewportBounds.y, _viewportBounds.width, _viewportBounds.height);
+    // Update text opacity each frame since opacity is updated in Control::update.
+    _textColor = getTextColor(getState());
+    _textColor.w *= _opacity;
+}
+
+void Label::updateState(State state)
+{
+    Control::updateState(state);
 
 
-    Control::State state = getState();
     _font = getFont(state);
     _font = getFont(state);
-    _textColor = getTextColor(state);
-    _textColor.w *= _opacity;
+}
 
 
-    Font* font = getFont(state);
-    if ((_autoWidth == Control::AUTO_SIZE_FIT || _autoHeight == Control::AUTO_SIZE_FIT) && font)
+void Label::updateBounds()
+{
+    Control::updateBounds();
+
+    if (_autoSize != AUTO_SIZE_NONE && _font)
     {
     {
+        // Measure bounds based only on normal state so that bounds updates are not always required on state changes.
+        // This is a trade-off for functionality vs performance, but changing the size of UI controls on hover/focus/etc
+        // is a pretty bad practice so we'll prioritize performance here.
         unsigned int w, h;
         unsigned int w, h;
-        font->measureText(_text.c_str(), getFontSize(state), &w, &h);
-        if (_autoWidth == Control::AUTO_SIZE_FIT)
-            setWidth(w + getBorder(state).left + getBorder(state).right + getPadding().left + getPadding().right);
-        if (_autoHeight == Control::AUTO_SIZE_FIT)
-            setHeight(h + getBorder(state).top + getBorder(state).bottom + getPadding().top + getPadding().bottom);
+        _font->measureText(_text.c_str(), getFontSize(NORMAL), &w, &h);
+        if (_autoSize & AUTO_SIZE_WIDTH)
+        {
+            setWidthInternal(w + getBorder(NORMAL).left + getBorder(NORMAL).right + getPadding().left + getPadding().right);
+        }
+        if (_autoSize & AUTO_SIZE_HEIGHT)
+        {
+            setHeightInternal(h + getBorder(NORMAL).top + getBorder(NORMAL).bottom + getPadding().top + getPadding().bottom);
+        }
     }
     }
 }
 }
 
 
+void Label::updateAbsoluteBounds(const Vector2& offset)
+{
+    Control::updateAbsoluteBounds(offset);
+
+    _textBounds.set((int)_viewportBounds.x, (int)_viewportBounds.y, _viewportBounds.width, _viewportBounds.height);
+}
+
 unsigned int Label::drawText(Form* form, const Rectangle& clip)
 unsigned int Label::drawText(Form* form, const Rectangle& clip)
 {
 {
     // Draw the text.
     // Draw the text.

+ 17 - 6
gameplay/src/Label.h

@@ -92,13 +92,24 @@ protected:
     void initialize(const char* typeName, Theme::Style* style, Properties* properties);
     void initialize(const char* typeName, Theme::Style* style, Properties* properties);
 
 
     /**
     /**
-     * Called when a label's properties change. Updates this label's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This label's parent container.
-     * @param offset The scroll offset of this label's parent container.
+     * @see Control::update
+     */
+    void update(float elapsedTime);
+
+    /**
+     * @see Control::updateState
+     */
+    void updateState(State state);
+
+    /**
+     * @see Control::updateBounds
+     */
+    void updateBounds();
+
+    /**
+     * @see Control::updateAbsoluteBounds
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateAbsoluteBounds(const Vector2& offset);
 
 
     /**
     /**
      * @see Control::drawText
      * @see Control::drawText

+ 0 - 64
gameplay/src/Layout.cpp

@@ -7,70 +7,6 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-void Layout::align(Control* control, const Container* container)
-{
-    GP_ASSERT(control);
-
-    if (control->_alignment != Control::ALIGN_TOP_LEFT ||
-        control->_isAlignmentSet)
-    {
-        const Rectangle& controlBounds = control->getBounds();
-        const Theme::Margin& controlMargin = control->getMargin();
-        const Rectangle& containerBounds = container ? container->getBounds() : Game::getInstance()->getViewport();
-        const Theme::Border& containerBorder = container ? container->getBorder(container->getState()) : Theme::Border::empty();
-        const Theme::Padding& containerPadding = container ? container->getPadding() : Theme::Padding::empty();
-
-        float clipWidth;
-        float clipHeight; 
-        if (container && (container->getScroll() != Container::SCROLL_NONE))
-        {
-            const Rectangle& verticalScrollBarBounds = container->getImageRegion("verticalScrollBar", container->getState());
-            const Rectangle& horizontalScrollBarBounds = container->getImageRegion("horizontalScrollBar", container->getState());
-            clipWidth = containerBounds.width - containerBorder.left - containerBorder.right - containerPadding.left - containerPadding.right - verticalScrollBarBounds.width;
-            clipHeight = containerBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom - horizontalScrollBarBounds.height;
-        }
-        else
-        {
-            clipWidth = containerBounds.width - containerBorder.left - containerBorder.right - containerPadding.left - containerPadding.right;
-            clipHeight = containerBounds.height - containerBorder.top - containerBorder.bottom - containerPadding.top - containerPadding.bottom;
-        }
-
-        // Vertical alignment
-        if (control->_isAlignmentSet || control->_autoHeight)
-        {
-            if ((control->_alignment & Control::ALIGN_BOTTOM) == Control::ALIGN_BOTTOM)
-            {
-                control->setY(clipHeight - controlBounds.height - controlMargin.bottom);
-            }
-            else if ((control->_alignment & Control::ALIGN_VCENTER) == Control::ALIGN_VCENTER)
-            {
-                control->setY(clipHeight * 0.5f - controlBounds.height * 0.5f);
-            }
-            else if ((control->_alignment & Control::ALIGN_TOP) == Control::ALIGN_TOP)
-            {
-                control->setY(controlMargin.top);
-            }
-        }
-
-        // Horizontal alignment
-        if (control->_isAlignmentSet)
-        {
-            if ((control->_alignment & Control::ALIGN_RIGHT) == Control::ALIGN_RIGHT)
-            {
-                control->setX(clipWidth - controlBounds.width - controlMargin.right);
-            }
-            else if ((control->_alignment & Control::ALIGN_HCENTER) == Control::ALIGN_HCENTER)
-            {
-                control->setX(clipWidth * 0.5f - controlBounds.width * 0.5f);
-            }
-            else if ((control->_alignment & Control::ALIGN_LEFT) == Control::ALIGN_LEFT)
-            {
-                control->setX(controlMargin.left);
-            }
-        }
-    }
-}
-
 bool Layout::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 bool Layout::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
 {
     return false;
     return false;

+ 2 - 10
gameplay/src/Layout.h

@@ -64,17 +64,8 @@ protected:
      * Position, resize, and update the controls within a container.
      * Position, resize, and update the controls within a container.
      *
      *
      * @param container The container to update.
      * @param container The container to update.
-     * @param offset The update offset.
      */
      */
-    virtual void update(const Container* container, const Vector2& offset) = 0;
-
-    /**
-     * Align a control within a container.
-     *
-     * @param control The control to align.
-     * @param container The container to align the control within.
-     */
-    virtual void align(Control* control, const Container* container);
+    virtual void update(const Container* container) = 0;
 
 
     /**
     /**
      * Touch callback on touch events.  Coordinates are given relative to the container's
      * Touch callback on touch events.  Coordinates are given relative to the container's
@@ -88,6 +79,7 @@ protected:
      * @see Touch::TouchEvent
      * @see Touch::TouchEvent
      */
      */
     virtual bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
     virtual bool touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
+
 };
 };
 
 
 }
 }

+ 1 - 1
gameplay/src/ParticleEmitter.cpp

@@ -75,7 +75,7 @@ ParticleEmitter* ParticleEmitter::create(const char* url)
         GP_ERROR("Failed to create particle emitter from file.");
         GP_ERROR("Failed to create particle emitter from file.");
         return NULL;
         return NULL;
     }
     }
-
+    
     ParticleEmitter* particle = create((strlen(properties->getNamespace()) > 0) ? properties : properties->getNextNamespace());
     ParticleEmitter* particle = create((strlen(properties->getNamespace()) > 0) ? properties : properties->getNextNamespace());
     SAFE_DELETE(properties);
     SAFE_DELETE(properties);
 
 

+ 30 - 57
gameplay/src/RadioButton.cpp

@@ -46,8 +46,6 @@ void RadioButton::initialize(const char* typeName, Theme::Style* style, Properti
 
 
     if (properties)
     if (properties)
     {
     {
-        properties->getVector2("imageSize", &_imageSize);
-
         if (properties->getBool("selected"))
         if (properties->getBool("selected"))
         {
         {
             RadioButton::clearSelected(_groupId);
             RadioButton::clearSelected(_groupId);
@@ -75,22 +73,11 @@ void RadioButton::setSelected(bool selected)
     if (selected != _selected)
     if (selected != _selected)
     {
     {
         _selected = selected;
         _selected = selected;
-        _dirty = true;
+        setDirty(DIRTY_STATE);
         notifyListeners(Control::Listener::VALUE_CHANGED);
         notifyListeners(Control::Listener::VALUE_CHANGED);
     }
     }
 }
 }
 
 
-void RadioButton::setImageSize(float width, float height)
-{
-    _imageSize.set(width, height);
-    _dirty = true;
-}
-
-const Vector2& RadioButton::getImageSize() const
-{
-    return _imageSize;
-}
-
 void RadioButton::addListener(Control::Listener* listener, int eventFlags)
 void RadioButton::addListener(Control::Listener* listener, int eventFlags)
 {
 {
     if ((eventFlags & Control::Listener::TEXT_CHANGED) == Control::Listener::TEXT_CHANGED)
     if ((eventFlags & Control::Listener::TEXT_CHANGED) == Control::Listener::TEXT_CHANGED)
@@ -110,9 +97,7 @@ void RadioButton::clearSelected(const std::string& groupId)
         GP_ASSERT(radioButton);
         GP_ASSERT(radioButton);
         if (groupId == radioButton->_groupId)
         if (groupId == radioButton->_groupId)
         {
         {
-            radioButton->_selected = false;
-            radioButton->_dirty = true;
-            radioButton->notifyListeners(Control::Listener::VALUE_CHANGED);
+            radioButton->setSelected(false);
         }
         }
     }
     }
 }
 }
@@ -146,51 +131,49 @@ void RadioButton::controlEvent(Control::Listener::EventType evt)
     }
     }
 }
 }
 
 
-void RadioButton::update(const Control* container, const Vector2& offset)
+void RadioButton::updateState(State state)
+{
+    Label::updateState(state);
+
+    _image = getImage(_selected ? "selected" : "unselected", state);
+}
+
+void RadioButton::updateBounds()
 {
 {
-    Label::update(container, offset);
+    Label::updateBounds();
 
 
     Vector2 size;
     Vector2 size;
-    if (_imageSize.isZero())
+    if (_selected)
     {
     {
-        if (_selected)
-        {
-            const Rectangle& selectedRegion = getImageRegion("selected", getState());
-            size.set(selectedRegion.width, selectedRegion.height);
-        }
-        else
-        {
-            const Rectangle& unselectedRegion = getImageRegion("unselected", getState());
-            size.set(unselectedRegion.width, unselectedRegion.height);
-        }
+        const Rectangle& selectedRegion = getImageRegion("selected", NORMAL);
+        size.set(selectedRegion.width, selectedRegion.height);
     }
     }
     else
     else
     {
     {
-        size.set(_imageSize);
+        const Rectangle& unselectedRegion = getImageRegion("unselected", NORMAL);
+        size.set(unselectedRegion.width, unselectedRegion.height);
     }
     }
 
 
-    if (_autoWidth == Control::AUTO_SIZE_FIT)
+    if (_autoSize & AUTO_SIZE_HEIGHT)
     {
     {
         // Text-only width was already measured in Label::update - append image
         // Text-only width was already measured in Label::update - append image
-        setWidth(size.x + _bounds.width + 5);
+        const Theme::Border& border = getBorder(NORMAL);
+        const Theme::Border& padding = getPadding();
+        setHeightInternal(std::max(_bounds.height, size.y + border.top + border.bottom + padding.top + padding.bottom));
     }
     }
 
 
-    if (_autoHeight == Control::AUTO_SIZE_FIT)
+    if (_autoSize & AUTO_SIZE_WIDTH)
     {
     {
         // Text-only width was already measured in Label::update - append image
         // Text-only width was already measured in Label::update - append image
-        setHeight(std::max(getHeight(), size.y));
+        setWidthInternal(_bounds.height + 5 + _bounds.width);
     }
     }
+}
 
 
-    _textBounds.x += size.x + 5;
-    
-    if (_selected)
-    {
-        _image = getImage("selected", getState());
-    }
-    else
-    {
-        _image = getImage("unselected", getState());
-    }
+void RadioButton::updateAbsoluteBounds(const Vector2& offset)
+{
+    Label::updateAbsoluteBounds(offset);
+
+    _textBounds.x += _bounds.height + 5;
 }
 }
 
 
 unsigned int RadioButton::drawImages(Form* form, const Rectangle& clip)
 unsigned int RadioButton::drawImages(Form* form, const Rectangle& clip)
@@ -205,21 +188,11 @@ unsigned int RadioButton::drawImages(Form* form, const Rectangle& clip)
     Vector4 color = _image->getColor();
     Vector4 color = _image->getColor();
     color.w *= _opacity;
     color.w *= _opacity;
 
 
-    Vector2 size;
-    if (_imageSize.isZero())
-    {
-        size.set(region.width, region.height);
-    }
-    else
-    {
-        size.set(_imageSize);
-    }
-
-    Vector2 pos(_viewportBounds.x, _viewportBounds.y + _viewportBounds.height * 0.5f - size.y * 0.5f);
+    Vector2 pos(_viewportBounds.x, _viewportBounds.y);
 
 
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     startBatch(form, batch);
     startBatch(form, batch);
-    batch->draw(pos.x, pos.y, size.x, size.y, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
+    batch->draw(pos.x, pos.y, _viewportBounds.height, _viewportBounds.height, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
     finishBatch(form, batch);
     finishBatch(form, batch);
 
 
     return 1;
     return 1;

+ 14 - 28
gameplay/src/RadioButton.h

@@ -47,21 +47,6 @@ public:
      */
      */
     void setSelected(bool selected);
     void setSelected(bool selected);
 
 
-    /**
-     * Set the size to draw the radio button icon.
-     *
-     * @param width The width to draw the radio button icon.
-     * @param height The height to draw the radio button icon.
-     */
-    void setImageSize(float width, float height);
-
-    /**
-     * Get the size at which the radio button icon will be drawn.
-     *
-     * @return The size of the radio button icon.
-     */
-    const Vector2& getImageSize() const;
-
     /**
     /**
      * @see Control::getType
      * @see Control::getType
      */
      */
@@ -133,13 +118,19 @@ protected:
     void controlEvent(Control::Listener::EventType evt);
     void controlEvent(Control::Listener::EventType evt);
 
 
     /**
     /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This control's parent container.
-     * @param offset Positioning offset to add to the control's position.
+     * @see Control::updateState
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateState(State state);
+
+    /**
+     * @see Control::updateBounds
+     */
+    void updateBounds();
+
+    /**
+     * @see Control::updateAbsoluteBounds
+     */
+    void updateAbsoluteBounds(const Vector2& offset);
 
 
     /**
     /**
      * @see Control::drawImages
      * @see Control::drawImages
@@ -162,15 +153,10 @@ protected:
      * Whether the RadioButton is currently selected.
      * Whether the RadioButton is currently selected.
      */
      */
     bool _selected;
     bool _selected;
-    
-    /**
-     * The size at which the RadioButton's icon will be drawn.
-     */
-    Vector2 _imageSize;
 
 
     /**
     /**
-     * The ThemeImage to use for the RadioButton.
-     */ 
+     * The theme image for the radio button.
+     */
     Theme::ThemeImage* _image;
     Theme::ThemeImage* _image;
 
 
 private:
 private:

+ 149 - 123
gameplay/src/Slider.cpp

@@ -11,7 +11,8 @@ static const float MOVE_FRACTION = 0.005f;
 
 
 Slider::Slider() : _min(0.0f), _max(0.0f), _step(0.0f), _value(0.0f), _delta(0.0f), _minImage(NULL),
 Slider::Slider() : _min(0.0f), _max(0.0f), _step(0.0f), _value(0.0f), _delta(0.0f), _minImage(NULL),
     _maxImage(NULL), _trackImage(NULL), _markerImage(NULL), _valueTextVisible(false),
     _maxImage(NULL), _trackImage(NULL), _markerImage(NULL), _valueTextVisible(false),
-    _valueTextAlignment(Font::ALIGN_BOTTOM_HCENTER), _valueTextPrecision(0), _valueText(""), _gamepadValue(0.0f)
+    _valueTextAlignment(Font::ALIGN_BOTTOM_HCENTER), _valueTextPrecision(0), _valueText(""), 
+    _trackHeight(0.0f), _gamepadValue(0.0f)
 {
 {
     _canFocus = true;
     _canFocus = true;
 }
 }
@@ -53,14 +54,13 @@ void Slider::initialize(const char* typeName, Theme::Style* style, Properties* p
             _valueTextAlignment = Font::getJustify(properties->getString("valueTextAlignment"));
             _valueTextAlignment = Font::getJustify(properties->getString("valueTextAlignment"));
         }
         }
     }
     }
+
+    // Force value text to be updated
+    setValue(_value);
 }
 }
 
 
 void Slider::setMin(float min)
 void Slider::setMin(float min)
 {
 {
-    if (_min != _min)
-    {
-        _dirty = true;
-    }
     _min = min;
     _min = min;
 }
 }
 
 
@@ -71,10 +71,6 @@ float Slider::getMin() const
 
 
 void Slider::setMax(float max)
 void Slider::setMax(float max)
 {
 {
-    if (max != _max)
-    {
-        _dirty = true;
-    }
     _max = max;
     _max = max;
 }
 }
 
 
@@ -100,11 +96,20 @@ float Slider::getValue() const
 
 
 void Slider::setValue(float value)
 void Slider::setValue(float value)
 {
 {
-    float oldValue = _value;
-    _value = MATH_CLAMP(value, _min, _max);
-    if (_value != value)
+    value = MATH_CLAMP(value, _min, _max);
+
+    if (value != _value)
     {
     {
-        _dirty = true;
+        _value = value;
+        notifyListeners(Control::Listener::VALUE_CHANGED);
+    }
+
+    // Always update value text if it's visible
+    if (_valueTextVisible)
+    {
+        char s[32];
+        sprintf(s, "%.*f", _valueTextPrecision, _value);
+        _valueText = s;
     }
     }
 }
 }
 
 
@@ -112,9 +117,10 @@ void Slider::setValueTextVisible(bool valueTextVisible)
 {
 {
     if (valueTextVisible != _valueTextVisible)
     if (valueTextVisible != _valueTextVisible)
     {
     {
-        _dirty = true;
+        _valueTextVisible = valueTextVisible;
+        if (_autoSize & AUTO_SIZE_HEIGHT)
+            setDirty(DIRTY_BOUNDS);
     }
     }
-    _valueTextVisible = valueTextVisible;
 }
 }
 
 
 bool Slider::isValueTextVisible() const
 bool Slider::isValueTextVisible() const
@@ -124,10 +130,6 @@ bool Slider::isValueTextVisible() const
 
 
 void Slider::setValueTextAlignment(Font::Justify alignment)
 void Slider::setValueTextAlignment(Font::Justify alignment)
 {
 {
-    if (alignment != _valueTextAlignment)
-    {
-        _dirty = true;
-    }
     _valueTextAlignment = alignment;
     _valueTextAlignment = alignment;
 }
 }
 
 
@@ -138,10 +140,6 @@ Font::Justify Slider::getValueTextAlignment() const
 
 
 void Slider::setValueTextPrecision(unsigned int precision)
 void Slider::setValueTextPrecision(unsigned int precision)
 {
 {
-    if (precision != _valueTextPrecision)
-    {
-        _dirty = true;
-    }
     _valueTextPrecision = precision;
     _valueTextPrecision = precision;
 }
 }
 
 
@@ -164,43 +162,32 @@ void Slider::updateValue(int x, int y)
 {
 {
     State state = getState();
     State state = getState();
 
 
-    // If the point lies within this slider, update the value of the slider accordingly
-    if (x > _clipBounds.x && x <= _clipBounds.x + _clipBounds.width &&
-        y > _clipBounds.y && y <= _clipBounds.y + _clipBounds.height)
-    {
-        // Horizontal case.
-        const Theme::Border& border = getBorder(state);
-        const Theme::Padding& padding = getPadding();
-        const Rectangle& minCapRegion = _minImage->getRegion();
-        const Rectangle& maxCapRegion = _maxImage->getRegion();
-
-        float markerPosition = ((float)x - maxCapRegion.width - border.left - padding.left) /
-            (_bounds.width - border.left - border.right - padding.left - padding.right - minCapRegion.width - maxCapRegion.width);
-            
-        if (markerPosition > 1.0f)
-        {
-            markerPosition = 1.0f;
-        }
-        else if (markerPosition < 0.0f)
-        {
-            markerPosition = 0.0f;
-        }
+    // Horizontal case.
+    const Theme::Border& border = getBorder(state);
+    const Theme::Padding& padding = getPadding();
+    const Rectangle& minCapRegion = _minImage->getRegion();
+    const Rectangle& maxCapRegion = _maxImage->getRegion();
+    const Rectangle& markerRegion = _markerImage->getRegion();
 
 
-        float oldValue = _value;
-        _value = (markerPosition * (_max - _min)) + _min;
-        if (_step > 0.0f)
-        {            
-            int numSteps = round(_value / _step);
-            _value = _step * numSteps;
-        }
+    float markerPosition = x / (_viewportBounds.width - markerRegion.width);
+            
+    if (markerPosition > 1.0f)
+    {
+        markerPosition = 1.0f;
+    }
+    else if (markerPosition < 0.0f)
+    {
+        markerPosition = 0.0f;
+    }
 
 
-        // Call the callback if our value changed.
-        if (_value != oldValue)
-        {
-            notifyListeners(Control::Listener::VALUE_CHANGED);
-        }
-        _dirty = true;
+    float value = (markerPosition * (_max - _min)) + _min;
+    if (_step > 0.0f)
+    {            
+        int numSteps = round(value / _step);
+        value = _step * numSteps;
     }
     }
+
+    setValue(value);
 }
 }
 
 
 bool Slider::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 bool Slider::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
@@ -243,26 +230,15 @@ bool Slider::mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta)
             if (hasFocus() && !isScrollable(_parent))
             if (hasFocus() && !isScrollable(_parent))
             {
             {
                 float total = _max - _min;
                 float total = _max - _min;
-                float oldValue = _value;
-                _value += (total * SCROLLWHEEL_FRACTION) * wheelDelta;
-            
-                if (_value > _max)
-                    _value = _max;
-                else if (_value < _min)
-                    _value = _min;
+                float value = _value + (total * SCROLLWHEEL_FRACTION) * wheelDelta;
 
 
                 if (_step > 0.0f)
                 if (_step > 0.0f)
                 {            
                 {            
-                    int numSteps = round(_value / _step);
-                    _value = _step * numSteps;
+                    int numSteps = round(value / _step);
+                    value = _step * numSteps;
                 }
                 }
 
 
-                if (_value != oldValue)
-                {
-                    notifyListeners(Control::Listener::VALUE_CHANGED);
-                }
-
-                _dirty = true;
+                setValue(value);
                 return true;
                 return true;
             }
             }
             break;
             break;
@@ -289,7 +265,6 @@ bool Slider::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsigned
                 gamepad->getJoystickValues(analogIndex, &joy);
                 gamepad->getJoystickValues(analogIndex, &joy);
                 _gamepadValue = _value;
                 _gamepadValue = _value;
                 _delta = joy.x;
                 _delta = joy.x;
-                _dirty = true;
                 return true;
                 return true;
             }
             }
             break;
             break;
@@ -309,25 +284,23 @@ bool Slider::keyEvent(Keyboard::KeyEvent evt, int key)
         case Keyboard::KEY_LEFT_ARROW:
         case Keyboard::KEY_LEFT_ARROW:
             if (_step > 0.0f)
             if (_step > 0.0f)
             {
             {
-                _value = std::max(_value - _step, _min);
+                setValue(std::max(_value - _step, _min));
             }
             }
             else
             else
             {
             {
-                _value = std::max(_value - (_max - _min) * MOVE_FRACTION, _min);
+                setValue(std::max(_value - (_max - _min) * MOVE_FRACTION, _min));
             }
             }
-            _dirty = true;
             return true;
             return true;
 
 
         case Keyboard::KEY_RIGHT_ARROW:
         case Keyboard::KEY_RIGHT_ARROW:
             if (_step > 0.0f)
             if (_step > 0.0f)
             {
             {
-                _value = std::min(_value + _step, _max);
+                setValue(std::min(_value + _step, _max));
             }
             }
             else
             else
             {
             {
-                _value = std::min(_value + (_max - _min) * MOVE_FRACTION, _max);
+                setValue(std::min(_value + (_max - _min) * MOVE_FRACTION, _max));
             }
             }
-            _dirty = true;
             return true;
             return true;
         }
         }
         break;
         break;
@@ -336,58 +309,53 @@ bool Slider::keyEvent(Keyboard::KeyEvent evt, int key)
     return Control::keyEvent(evt, key);
     return Control::keyEvent(evt, key);
 }
 }
 
 
-void Slider::update(const Control* container, const Vector2& offset)
+void Slider::update(float elapsedTime)
 {
 {
-    Label::update(container, offset);
-
-    Control::State state = getState();
-
-    _minImage = getImage("minCap", state);
-    _maxImage = getImage("maxCap", state);
-    _markerImage = getImage("marker", state);
-    _trackImage = getImage("track", state);
-
-    char s[32];
-    sprintf(s, "%.*f", _valueTextPrecision, _value);
-    _valueText = s;
+    Label::update(elapsedTime);
 
 
     if (_delta != 0.0f)
     if (_delta != 0.0f)
     {
     {
-        float oldValue = _value;
         float total = _max - _min;
         float total = _max - _min;
 
 
         if (_step > 0.0f)
         if (_step > 0.0f)
         {
         {
             _gamepadValue += (total * MOVE_FRACTION) * _delta;
             _gamepadValue += (total * MOVE_FRACTION) * _delta;
             int numSteps = round(_gamepadValue / _step);
             int numSteps = round(_gamepadValue / _step);
-            _value = _step * numSteps;
+            setValue(_step * numSteps);
         }
         }
         else
         else
         {
         {
-            _value += (total * MOVE_FRACTION) * _delta;
+            setValue(_value + (total * MOVE_FRACTION) * _delta);
         }
         }
+    }
+}
 
 
-        if (_value > _max)
-            _value = _max;
-        else if (_value < _min)
-            _value = _min;
+void Slider::updateState(State state)
+{
+    Label::updateState(state);
 
 
-        if (_value != oldValue)
-        {
-            notifyListeners(Control::Listener::VALUE_CHANGED);
-        }
-    }
+    _minImage = getImage("minCap", state);
+    _maxImage = getImage("maxCap", state);
+    _markerImage = getImage("marker", state);
+    _trackImage = getImage("track", state);
+}
+
+void Slider::updateBounds()
+{
+    Label::updateBounds();
+
+    // Compute height of track (max of track, min/max and marker
+    _trackHeight = _minImage->getRegion().height;
+    _trackHeight = std::max(_trackHeight, _maxImage->getRegion().height);
+    _trackHeight = std::max(_trackHeight, _markerImage->getRegion().height);
+    _trackHeight = std::max(_trackHeight, _trackImage->getRegion().height);
 
 
-    if (_autoHeight == Control::AUTO_SIZE_FIT)
+    if (_autoSize & AUTO_SIZE_HEIGHT)
     {
     {
-        float height = _minImage->getRegion().height;
-        height = std::max(height, _maxImage->getRegion().height);
-        height = std::max(height, _markerImage->getRegion().height);
-        height = std::max(height, _trackImage->getRegion().height);
-        height += _bounds.height;
-        if (_valueTextVisible && _font)
-            height += getFontSize(state);
-        setHeight(height);
+        float height = _bounds.height + _trackHeight;
+        if (_valueTextVisible)
+            height += getFontSize(NORMAL);
+        setHeightInternal(height);
     }
     }
 }
 }
 
 
@@ -416,6 +384,8 @@ unsigned int Slider::drawImages(Form* form, const Rectangle& clip)
     Vector4 markerColor = _markerImage->getColor();
     Vector4 markerColor = _markerImage->getColor();
     Vector4 trackColor = _trackImage->getColor();
     Vector4 trackColor = _trackImage->getColor();
 
 
+    Control::State state = getState();
+
     minCapColor.w *= _opacity;
     minCapColor.w *= _opacity;
     maxCapColor.w *= _opacity;
     maxCapColor.w *= _opacity;
     markerColor.w *= _opacity;
     markerColor.w *= _opacity;
@@ -424,23 +394,79 @@ unsigned int Slider::drawImages(Form* form, const Rectangle& clip)
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     SpriteBatch* batch = _style->getTheme()->getSpriteBatch();
     startBatch(form, batch);
     startBatch(form, batch);
 
 
-    // Draw order: track, caps, marker.
-    float midY = _viewportBounds.y + (_viewportBounds.height) * 0.5f;
-    Vector2 pos(_viewportBounds.x, midY - trackRegion.height * 0.5f);
-    batch->draw(pos.x, pos.y, _viewportBounds.width, trackRegion.height, track.u1, track.v1, track.u2, track.v2, trackColor, _viewportClipBounds);
+    // Compute area to draw the slider track
+    unsigned int fontSize = getFontSize(state);
+    float startY, endY;
+    if (_text.length() > 0)
+    {
+        if (_valueTextVisible)
+        {
+            // Both label and value text are visible.
+            // Draw slider in the middle.
+            startY = fontSize;
+            endY = _viewportBounds.height - fontSize;
+        }
+        else
+        {
+            // Only label is visible
+            if (getTextAlignment(state) & ALIGN_BOTTOM)
+            {
+                // Draw slider above label
+                startY = 0;
+                endY = _viewportBounds.height - fontSize;
+            }
+            else
+            {
+                // Draw slider below label
+                startY = fontSize;
+                endY = _viewportBounds.height;
+            }
+        }
+    }
+    else if (_valueTextVisible)
+    {
+        // Only value text is visible.
+        if (_valueTextAlignment & ALIGN_BOTTOM)
+        {
+            // Draw slider above value text
+            startY = 0;
+            endY = _viewportBounds.height - fontSize;
+        }
+        else
+        {
+            // Draw slider below value text
+            startY = fontSize;
+            endY = _viewportBounds.height;
+        }
+    }
+    else
+    {
+        // Only the slider track is visible
+        startY = 0;
+        endY = _viewportBounds.height;
+    }
+
+    // Compute midpoint of track location
+    float midY = _viewportBounds.y + startY + (endY - startY) * 0.5f;
+
+    // Draw track below the slider text
+    Vector2 pos(_viewportBounds.x + minCapRegion.width, midY - trackRegion.height * 0.5f);
+    batch->draw(pos.x, pos.y, _viewportBounds.width - minCapRegion.width - maxCapRegion.width, trackRegion.height, track.u1, track.v1, track.u2, track.v2, trackColor, _viewportClipBounds);
 
 
+    // Draw min cap to the left of the track
     pos.y = midY - minCapRegion.height * 0.5f;
     pos.y = midY - minCapRegion.height * 0.5f;
-    pos.x -= minCapRegion.width * 0.5f;
+    pos.x = _viewportBounds.x;
     batch->draw(pos.x, pos.y, minCapRegion.width, minCapRegion.height, minCap.u1, minCap.v1, minCap.u2, minCap.v2, minCapColor, _viewportClipBounds);
     batch->draw(pos.x, pos.y, minCapRegion.width, minCapRegion.height, minCap.u1, minCap.v1, minCap.u2, minCap.v2, minCapColor, _viewportClipBounds);
 
 
-    pos.x = _viewportBounds.x + _viewportBounds.width - maxCapRegion.width * 0.5f;
+    // Draw max cap to the right of the track
+    pos.x = _viewportBounds.right() - maxCapRegion.width;
     batch->draw(pos.x, pos.y, maxCapRegion.width, maxCapRegion.height, maxCap.u1, maxCap.v1, maxCap.u2, maxCap.v2, maxCapColor, _viewportClipBounds);
     batch->draw(pos.x, pos.y, maxCapRegion.width, maxCapRegion.height, maxCap.u1, maxCap.v1, maxCap.u2, maxCap.v2, maxCapColor, _viewportClipBounds);
 
 
-    // Percent across.
+    // Draw the marker at the correct position
     float markerPosition = (_value - _min) / (_max - _min);
     float markerPosition = (_value - _min) / (_max - _min);
-    markerPosition *= _viewportBounds.width - minCapRegion.width * 0.5f - maxCapRegion.width * 0.5f - markerRegion.width;
-    pos.x = _viewportBounds.x + minCapRegion.width * 0.5f + markerPosition;
-    pos.y = midY - markerRegion.height / 2.0f;
+    markerPosition *= _viewportBounds.width - markerRegion.width;
+    pos.x = _viewportBounds.x + markerPosition;
+    pos.y = midY - markerRegion.height * 0.5f;
     batch->draw(pos.x, pos.y, markerRegion.width, markerRegion.height, marker.u1, marker.v1, marker.u2, marker.v2, markerColor, _viewportClipBounds);
     batch->draw(pos.x, pos.y, markerRegion.width, markerRegion.height, marker.u1, marker.v1, marker.u2, marker.v2, markerColor, _viewportClipBounds);
 
 
     finishBatch(form, batch);
     finishBatch(form, batch);

+ 14 - 6
gameplay/src/Slider.h

@@ -233,13 +233,19 @@ protected:
     unsigned int drawText(Form* form, const Rectangle& clip);
     unsigned int drawText(Form* form, const Rectangle& clip);
 
 
     /**
     /**
-     * Called when a slider's properties change. Updates this slider's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This slider's parent container.
-     * @param offset The scroll offset of this slider's parent container.
+     * @see Control::update
+     */
+    void update(float elapsedTime);
+
+    /**
+     * @see Control::updateState
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateState(State state);
+
+    /**
+     * @see Control::updateBounds
+     */
+    void updateBounds();
 
 
     /**
     /**
      * The minimum value for the Slider.
      * The minimum value for the Slider.
@@ -315,6 +321,8 @@ private:
      */
      */
     std::string _valueText;
     std::string _valueText;
 
 
+    float _trackHeight;
+
     float _gamepadValue;
     float _gamepadValue;
 };
 };
 
 

+ 2 - 12
gameplay/src/TextBox.cpp

@@ -70,14 +70,12 @@ bool TextBox::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int conta
         if (state == ACTIVE)
         if (state == ACTIVE)
         {
         {
             setCaretLocation(x, y);
             setCaretLocation(x, y);
-            _dirty = true;
         }
         }
         break;
         break;
     case Touch::TOUCH_MOVE:
     case Touch::TOUCH_MOVE:
         if (state == ACTIVE)
         if (state == ACTIVE)
         {
         {
             setCaretLocation(x, y);
             setCaretLocation(x, y);
-            _dirty = true;
         }
         }
         break;
         break;
     }
     }
@@ -149,13 +147,11 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                 case Keyboard::KEY_HOME:
                 case Keyboard::KEY_HOME:
                 {
                 {
                     _caretLocation = 0;
                     _caretLocation = 0;
-                    _dirty = true;
                     break;
                     break;
                 }
                 }
                 case Keyboard::KEY_END:
                 case Keyboard::KEY_END:
                 {
                 {
                     _caretLocation = _text.length();
                     _caretLocation = _text.length();
-                    _dirty = true;
                     break;
                     break;
                 }
                 }
                 case Keyboard::KEY_DELETE:
                 case Keyboard::KEY_DELETE:
@@ -172,7 +168,6 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                             newCaretLocation = _caretLocation + 1;
                             newCaretLocation = _caretLocation + 1;
                         }
                         }
                         _text.erase(_caretLocation, newCaretLocation - _caretLocation);
                         _text.erase(_caretLocation, newCaretLocation - _caretLocation);
-                        _dirty = true;
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                     }
                     }
                     break;
                     break;
@@ -195,7 +190,6 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                             --_caretLocation;
                             --_caretLocation;
                         }
                         }
                     }
                     }
-                    _dirty = true;
                     break;
                     break;
                 }
                 }
                 case Keyboard::KEY_RIGHT_ARROW:
                 case Keyboard::KEY_RIGHT_ARROW:
@@ -211,7 +205,6 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                             ++_caretLocation;
                             ++_caretLocation;
                         }
                         }
                     }
                     }
-                    _dirty = true;
                     break;
                     break;
                 }
                 }
                 case Keyboard::KEY_UP_ARROW:
                 case Keyboard::KEY_UP_ARROW:
@@ -239,7 +232,6 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                         }
                         }
                         _text.erase(newCaretLocation, _caretLocation - newCaretLocation);
                         _text.erase(newCaretLocation, _caretLocation - newCaretLocation);
                         _caretLocation = newCaretLocation;
                         _caretLocation = newCaretLocation;
-                        _dirty = true;
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                     }
                     }
                     break;
                     break;
@@ -273,7 +265,6 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                             ++_caretLocation;
                             ++_caretLocation;
                         }
                         }
 
 
-                        _dirty = true;
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                         notifyListeners(Control::Listener::TEXT_CHANGED);
                     }
                     }
                     break;
                     break;
@@ -315,11 +306,10 @@ void TextBox::controlEvent(Control::Listener::EventType evt)
     }
     }
 }
 }
 
 
-void TextBox::update(const Control* container, const Vector2& offset)
+void TextBox::updateState(State state)
 {
 {
-    Label::update(container, offset);
+    Label::updateState(state);
 
 
-    Control::State state = getState();
     _fontSize = getFontSize(state);
     _fontSize = getFontSize(state);
     _caretImage = getImage("textCaret", state);
     _caretImage = getImage("textCaret", state);
 }
 }

+ 2 - 6
gameplay/src/TextBox.h

@@ -166,13 +166,9 @@ protected:
     void controlEvent(Control::Listener::EventType evt);
     void controlEvent(Control::Listener::EventType evt);
 
 
     /**
     /**
-     * Called when a control's properties change.  Updates this control's internal rendering
-     * properties, such as its text viewport.
-     *
-     * @param container This control's parent container.
-     * @param offset Positioning offset to add to the control's position.
+     * @see Control::updateState
      */
      */
-    void update(const Control* container, const Vector2& offset);
+    void updateState(State state);
 
 
     /**
     /**
      * @see Control::drawImages
      * @see Control::drawImages

+ 1 - 1
gameplay/src/Theme.cpp

@@ -65,7 +65,7 @@ Theme* Theme::getDefault()
 		Properties* config = Game::getInstance()->getConfig()->getNamespace("ui", true);
 		Properties* config = Game::getInstance()->getConfig()->getNamespace("ui", true);
 		if (config)
 		if (config)
 		{
 		{
-			const char* defaultTheme = config->getString("defaultTheme");
+			const char* defaultTheme = config->getString("theme");
 			if (defaultTheme && FileSystem::fileExists(defaultTheme))
 			if (defaultTheme && FileSystem::fileExists(defaultTheme))
 				__defaultTheme = Theme::create(defaultTheme);
 				__defaultTheme = Theme::create(defaultTheme);
 		}
 		}

+ 5 - 0
gameplay/src/Theme.h

@@ -302,6 +302,11 @@ private:
          */
          */
         const Theme::Border& getBorder() const;
         const Theme::Border& getBorder() const;
 
 
+        /**
+         * Gets the skin region within the theme texture.
+         *
+         * @return The skin region.
+         */
         const Rectangle& getRegion() const;
         const Rectangle& getRegion() const;
 
 
         /**
         /**

+ 1 - 4
gameplay/src/VerticalLayout.cpp

@@ -42,7 +42,7 @@ void VerticalLayout::setSpacing(int spacing)
     _spacing = spacing;
     _spacing = spacing;
 }
 }
 
 
-void VerticalLayout::update(const Container* container, const Vector2& offset)
+void VerticalLayout::update(const Container* container)
 {
 {
     GP_ASSERT(container);
     GP_ASSERT(container);
 
 
@@ -75,15 +75,12 @@ void VerticalLayout::update(const Container* container, const Vector2& offset)
 
 
         if (control->isVisible())
         if (control->isVisible())
         {
         {
-            align(control, container);
-
             const Rectangle& bounds = control->getBounds();
             const Rectangle& bounds = control->getBounds();
             const Theme::Margin& margin = control->getMargin();
             const Theme::Margin& margin = control->getMargin();
 
 
             yPosition += margin.top;
             yPosition += margin.top;
 
 
             control->setPosition(margin.left, yPosition);
             control->setPosition(margin.left, yPosition);
-            control->update(container, offset);
 
 
             yPosition += bounds.height + margin.bottom + _spacing;
             yPosition += bounds.height + margin.bottom + _spacing;
         }
         }

+ 1 - 2
gameplay/src/VerticalLayout.h

@@ -75,9 +75,8 @@ protected:
      * the bottom-most edge of the container is reached.
      * the bottom-most edge of the container is reached.
      *
      *
      * @param container The container to update.
      * @param container The container to update.
-     * @param offset Positioning offset to add to the control's position.
      */
      */
-    void update(const Container* container, const Vector2& offset);
+    void update(const Container* container);
 
 
     /**
     /**
      * Flag determining whether this layout will start laying out controls from the bottom of the container.
      * Flag determining whether this layout will start laying out controls from the bottom of the container.

+ 16 - 125
gameplay/src/lua/lua_Button.cpp

@@ -42,8 +42,7 @@ void luaRegister_Button()
         {"getAnimation", lua_Button_getAnimation},
         {"getAnimation", lua_Button_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Button_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Button_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Button_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Button_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Button_getAutoHeight},
-        {"getAutoWidth", lua_Button_getAutoWidth},
+        {"getAutoSize", lua_Button_getAutoSize},
         {"getBorder", lua_Button_getBorder},
         {"getBorder", lua_Button_getBorder},
         {"getBounds", lua_Button_getBounds},
         {"getBounds", lua_Button_getBounds},
         {"getClip", lua_Button_getClip},
         {"getClip", lua_Button_getClip},
@@ -95,8 +94,7 @@ void luaRegister_Button()
         {"removeScriptCallback", lua_Button_removeScriptCallback},
         {"removeScriptCallback", lua_Button_removeScriptCallback},
         {"setAlignment", lua_Button_setAlignment},
         {"setAlignment", lua_Button_setAlignment},
         {"setAnimationPropertyValue", lua_Button_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Button_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Button_setAutoHeight},
-        {"setAutoWidth", lua_Button_setAutoWidth},
+        {"setAutoSize", lua_Button_setAutoSize},
         {"setBorder", lua_Button_setBorder},
         {"setBorder", lua_Button_setBorder},
         {"setBounds", lua_Button_setBounds},
         {"setBounds", lua_Button_setBounds},
         {"setCanFocus", lua_Button_setCanFocus},
         {"setCanFocus", lua_Button_setCanFocus},
@@ -973,7 +971,7 @@ int lua_Button_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Button_getAutoHeight(lua_State* state)
+int lua_Button_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -986,7 +984,7 @@ int lua_Button_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Button* instance = getInstance(state);
                 Button* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -994,42 +992,7 @@ int lua_Button_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Button_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Button_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Button_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3341,61 +3304,7 @@ int lua_Button_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Button_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Button* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Button* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Button_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Button_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3405,37 +3314,19 @@ int lua_Button_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Button* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Button* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Button* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Button_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Button_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_Button_getAlignment(lua_State* state);
 int lua_Button_getAnimation(lua_State* state);
 int lua_Button_getAnimation(lua_State* state);
 int lua_Button_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Button_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Button_getAnimationPropertyValue(lua_State* state);
 int lua_Button_getAnimationPropertyValue(lua_State* state);
-int lua_Button_getAutoHeight(lua_State* state);
-int lua_Button_getAutoWidth(lua_State* state);
+int lua_Button_getAutoSize(lua_State* state);
 int lua_Button_getBorder(lua_State* state);
 int lua_Button_getBorder(lua_State* state);
 int lua_Button_getBounds(lua_State* state);
 int lua_Button_getBounds(lua_State* state);
 int lua_Button_getClip(lua_State* state);
 int lua_Button_getClip(lua_State* state);
@@ -72,8 +71,7 @@ int lua_Button_removeListener(lua_State* state);
 int lua_Button_removeScriptCallback(lua_State* state);
 int lua_Button_removeScriptCallback(lua_State* state);
 int lua_Button_setAlignment(lua_State* state);
 int lua_Button_setAlignment(lua_State* state);
 int lua_Button_setAnimationPropertyValue(lua_State* state);
 int lua_Button_setAnimationPropertyValue(lua_State* state);
-int lua_Button_setAutoHeight(lua_State* state);
-int lua_Button_setAutoWidth(lua_State* state);
+int lua_Button_setAutoSize(lua_State* state);
 int lua_Button_setBorder(lua_State* state);
 int lua_Button_setBorder(lua_State* state);
 int lua_Button_setBounds(lua_State* state);
 int lua_Button_setBounds(lua_State* state);
 int lua_Button_setCanFocus(lua_State* state);
 int lua_Button_setCanFocus(lua_State* state);

+ 16 - 211
gameplay/src/lua/lua_CheckBox.cpp

@@ -43,8 +43,7 @@ void luaRegister_CheckBox()
         {"getAnimation", lua_CheckBox_getAnimation},
         {"getAnimation", lua_CheckBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_CheckBox_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_CheckBox_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_CheckBox_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_CheckBox_getAnimationPropertyValue},
-        {"getAutoHeight", lua_CheckBox_getAutoHeight},
-        {"getAutoWidth", lua_CheckBox_getAutoWidth},
+        {"getAutoSize", lua_CheckBox_getAutoSize},
         {"getBorder", lua_CheckBox_getBorder},
         {"getBorder", lua_CheckBox_getBorder},
         {"getBounds", lua_CheckBox_getBounds},
         {"getBounds", lua_CheckBox_getBounds},
         {"getClip", lua_CheckBox_getClip},
         {"getClip", lua_CheckBox_getClip},
@@ -60,7 +59,6 @@ void luaRegister_CheckBox()
         {"getId", lua_CheckBox_getId},
         {"getId", lua_CheckBox_getId},
         {"getImageColor", lua_CheckBox_getImageColor},
         {"getImageColor", lua_CheckBox_getImageColor},
         {"getImageRegion", lua_CheckBox_getImageRegion},
         {"getImageRegion", lua_CheckBox_getImageRegion},
-        {"getImageSize", lua_CheckBox_getImageSize},
         {"getImageUVs", lua_CheckBox_getImageUVs},
         {"getImageUVs", lua_CheckBox_getImageUVs},
         {"getMargin", lua_CheckBox_getMargin},
         {"getMargin", lua_CheckBox_getMargin},
         {"getOpacity", lua_CheckBox_getOpacity},
         {"getOpacity", lua_CheckBox_getOpacity},
@@ -99,8 +97,7 @@ void luaRegister_CheckBox()
         {"removeScriptCallback", lua_CheckBox_removeScriptCallback},
         {"removeScriptCallback", lua_CheckBox_removeScriptCallback},
         {"setAlignment", lua_CheckBox_setAlignment},
         {"setAlignment", lua_CheckBox_setAlignment},
         {"setAnimationPropertyValue", lua_CheckBox_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_CheckBox_setAnimationPropertyValue},
-        {"setAutoHeight", lua_CheckBox_setAutoHeight},
-        {"setAutoWidth", lua_CheckBox_setAutoWidth},
+        {"setAutoSize", lua_CheckBox_setAutoSize},
         {"setBorder", lua_CheckBox_setBorder},
         {"setBorder", lua_CheckBox_setBorder},
         {"setBounds", lua_CheckBox_setBounds},
         {"setBounds", lua_CheckBox_setBounds},
         {"setCanFocus", lua_CheckBox_setCanFocus},
         {"setCanFocus", lua_CheckBox_setCanFocus},
@@ -117,7 +114,6 @@ void luaRegister_CheckBox()
         {"setId", lua_CheckBox_setId},
         {"setId", lua_CheckBox_setId},
         {"setImageColor", lua_CheckBox_setImageColor},
         {"setImageColor", lua_CheckBox_setImageColor},
         {"setImageRegion", lua_CheckBox_setImageRegion},
         {"setImageRegion", lua_CheckBox_setImageRegion},
-        {"setImageSize", lua_CheckBox_setImageSize},
         {"setMargin", lua_CheckBox_setMargin},
         {"setMargin", lua_CheckBox_setMargin},
         {"setOpacity", lua_CheckBox_setOpacity},
         {"setOpacity", lua_CheckBox_setOpacity},
         {"setPadding", lua_CheckBox_setPadding},
         {"setPadding", lua_CheckBox_setPadding},
@@ -979,7 +975,7 @@ int lua_CheckBox_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_CheckBox_getAutoHeight(lua_State* state)
+int lua_CheckBox_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -992,7 +988,7 @@ int lua_CheckBox_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 CheckBox* instance = getInstance(state);
                 CheckBox* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1000,42 +996,7 @@ int lua_CheckBox_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_CheckBox_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_CheckBox_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -1773,50 +1734,6 @@ int lua_CheckBox_getImageRegion(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_CheckBox_getImageSize(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);
-                void* returnPtr = (void*)&(instance->getImageSize());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Vector2");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_getImageSize - 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_getImageUVs(lua_State* state)
 int lua_CheckBox_getImageUVs(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
@@ -3461,7 +3378,7 @@ int lua_CheckBox_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_CheckBox_setAutoHeight(lua_State* state)
+int lua_CheckBox_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3471,91 +3388,19 @@ int lua_CheckBox_setAutoHeight(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    CheckBox* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    CheckBox* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_CheckBox_setAutoHeight - 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_setAutoWidth(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    CheckBox* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    CheckBox* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                CheckBox* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_CheckBox_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_CheckBox_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -4378,46 +4223,6 @@ int lua_CheckBox_setImageRegion(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_CheckBox_setImageSize(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_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
-
-                CheckBox* instance = getInstance(state);
-                instance->setImageSize(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_setImageSize - 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_CheckBox_setMargin(lua_State* state)
 int lua_CheckBox_setMargin(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.

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

@@ -19,8 +19,7 @@ int lua_CheckBox_getAlignment(lua_State* state);
 int lua_CheckBox_getAnimation(lua_State* state);
 int lua_CheckBox_getAnimation(lua_State* state);
 int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state);
 int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state);
 int lua_CheckBox_getAnimationPropertyValue(lua_State* state);
 int lua_CheckBox_getAnimationPropertyValue(lua_State* state);
-int lua_CheckBox_getAutoHeight(lua_State* state);
-int lua_CheckBox_getAutoWidth(lua_State* state);
+int lua_CheckBox_getAutoSize(lua_State* state);
 int lua_CheckBox_getBorder(lua_State* state);
 int lua_CheckBox_getBorder(lua_State* state);
 int lua_CheckBox_getBounds(lua_State* state);
 int lua_CheckBox_getBounds(lua_State* state);
 int lua_CheckBox_getClip(lua_State* state);
 int lua_CheckBox_getClip(lua_State* state);
@@ -36,7 +35,6 @@ int lua_CheckBox_getHeight(lua_State* state);
 int lua_CheckBox_getId(lua_State* state);
 int lua_CheckBox_getId(lua_State* state);
 int lua_CheckBox_getImageColor(lua_State* state);
 int lua_CheckBox_getImageColor(lua_State* state);
 int lua_CheckBox_getImageRegion(lua_State* state);
 int lua_CheckBox_getImageRegion(lua_State* state);
-int lua_CheckBox_getImageSize(lua_State* state);
 int lua_CheckBox_getImageUVs(lua_State* state);
 int lua_CheckBox_getImageUVs(lua_State* state);
 int lua_CheckBox_getMargin(lua_State* state);
 int lua_CheckBox_getMargin(lua_State* state);
 int lua_CheckBox_getOpacity(lua_State* state);
 int lua_CheckBox_getOpacity(lua_State* state);
@@ -75,8 +73,7 @@ int lua_CheckBox_removeListener(lua_State* state);
 int lua_CheckBox_removeScriptCallback(lua_State* state);
 int lua_CheckBox_removeScriptCallback(lua_State* state);
 int lua_CheckBox_setAlignment(lua_State* state);
 int lua_CheckBox_setAlignment(lua_State* state);
 int lua_CheckBox_setAnimationPropertyValue(lua_State* state);
 int lua_CheckBox_setAnimationPropertyValue(lua_State* state);
-int lua_CheckBox_setAutoHeight(lua_State* state);
-int lua_CheckBox_setAutoWidth(lua_State* state);
+int lua_CheckBox_setAutoSize(lua_State* state);
 int lua_CheckBox_setBorder(lua_State* state);
 int lua_CheckBox_setBorder(lua_State* state);
 int lua_CheckBox_setBounds(lua_State* state);
 int lua_CheckBox_setBounds(lua_State* state);
 int lua_CheckBox_setCanFocus(lua_State* state);
 int lua_CheckBox_setCanFocus(lua_State* state);
@@ -93,7 +90,6 @@ int lua_CheckBox_setHeight(lua_State* state);
 int lua_CheckBox_setId(lua_State* state);
 int lua_CheckBox_setId(lua_State* state);
 int lua_CheckBox_setImageColor(lua_State* state);
 int lua_CheckBox_setImageColor(lua_State* state);
 int lua_CheckBox_setImageRegion(lua_State* state);
 int lua_CheckBox_setImageRegion(lua_State* state);
-int lua_CheckBox_setImageSize(lua_State* state);
 int lua_CheckBox_setMargin(lua_State* state);
 int lua_CheckBox_setMargin(lua_State* state);
 int lua_CheckBox_setOpacity(lua_State* state);
 int lua_CheckBox_setOpacity(lua_State* state);
 int lua_CheckBox_setPadding(lua_State* state);
 int lua_CheckBox_setPadding(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_Container.cpp

@@ -57,8 +57,7 @@ void luaRegister_Container()
         {"getAnimation", lua_Container_getAnimation},
         {"getAnimation", lua_Container_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Container_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Container_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Container_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Container_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Container_getAutoHeight},
-        {"getAutoWidth", lua_Container_getAutoWidth},
+        {"getAutoSize", lua_Container_getAutoSize},
         {"getBorder", lua_Container_getBorder},
         {"getBorder", lua_Container_getBorder},
         {"getBounds", lua_Container_getBounds},
         {"getBounds", lua_Container_getBounds},
         {"getClip", lua_Container_getClip},
         {"getClip", lua_Container_getClip},
@@ -124,8 +123,7 @@ void luaRegister_Container()
         {"setActiveControl", lua_Container_setActiveControl},
         {"setActiveControl", lua_Container_setActiveControl},
         {"setAlignment", lua_Container_setAlignment},
         {"setAlignment", lua_Container_setAlignment},
         {"setAnimationPropertyValue", lua_Container_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Container_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Container_setAutoHeight},
-        {"setAutoWidth", lua_Container_setAutoWidth},
+        {"setAutoSize", lua_Container_setAutoSize},
         {"setBorder", lua_Container_setBorder},
         {"setBorder", lua_Container_setBorder},
         {"setBounds", lua_Container_setBounds},
         {"setBounds", lua_Container_setBounds},
         {"setCanFocus", lua_Container_setCanFocus},
         {"setCanFocus", lua_Container_setCanFocus},
@@ -1099,7 +1097,7 @@ int lua_Container_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Container_getAutoHeight(lua_State* state)
+int lua_Container_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -1112,7 +1110,7 @@ int lua_Container_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Container* instance = getInstance(state);
                 Container* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1120,42 +1118,7 @@ int lua_Container_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Container_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Container_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Container_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -4073,61 +4036,7 @@ int lua_Container_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Container_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Container* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Container* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Container_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Container_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -4137,37 +4046,19 @@ int lua_Container_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Container* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Container* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Container* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Container_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Container_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -21,8 +21,7 @@ int lua_Container_getAlignment(lua_State* state);
 int lua_Container_getAnimation(lua_State* state);
 int lua_Container_getAnimation(lua_State* state);
 int lua_Container_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Container_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Container_getAnimationPropertyValue(lua_State* state);
 int lua_Container_getAnimationPropertyValue(lua_State* state);
-int lua_Container_getAutoHeight(lua_State* state);
-int lua_Container_getAutoWidth(lua_State* state);
+int lua_Container_getAutoSize(lua_State* state);
 int lua_Container_getBorder(lua_State* state);
 int lua_Container_getBorder(lua_State* state);
 int lua_Container_getBounds(lua_State* state);
 int lua_Container_getBounds(lua_State* state);
 int lua_Container_getClip(lua_State* state);
 int lua_Container_getClip(lua_State* state);
@@ -88,8 +87,7 @@ int lua_Container_removeScriptCallback(lua_State* state);
 int lua_Container_setActiveControl(lua_State* state);
 int lua_Container_setActiveControl(lua_State* state);
 int lua_Container_setAlignment(lua_State* state);
 int lua_Container_setAlignment(lua_State* state);
 int lua_Container_setAnimationPropertyValue(lua_State* state);
 int lua_Container_setAnimationPropertyValue(lua_State* state);
-int lua_Container_setAutoHeight(lua_State* state);
-int lua_Container_setAutoWidth(lua_State* state);
+int lua_Container_setAutoSize(lua_State* state);
 int lua_Container_setBorder(lua_State* state);
 int lua_Container_setBorder(lua_State* state);
 int lua_Container_setBounds(lua_State* state);
 int lua_Container_setBounds(lua_State* state);
 int lua_Container_setCanFocus(lua_State* state);
 int lua_Container_setCanFocus(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_Control.cpp

@@ -39,8 +39,7 @@ void luaRegister_Control()
         {"getAnimation", lua_Control_getAnimation},
         {"getAnimation", lua_Control_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Control_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Control_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Control_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Control_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Control_getAutoHeight},
-        {"getAutoWidth", lua_Control_getAutoWidth},
+        {"getAutoSize", lua_Control_getAutoSize},
         {"getBorder", lua_Control_getBorder},
         {"getBorder", lua_Control_getBorder},
         {"getBounds", lua_Control_getBounds},
         {"getBounds", lua_Control_getBounds},
         {"getClip", lua_Control_getClip},
         {"getClip", lua_Control_getClip},
@@ -92,8 +91,7 @@ void luaRegister_Control()
         {"removeScriptCallback", lua_Control_removeScriptCallback},
         {"removeScriptCallback", lua_Control_removeScriptCallback},
         {"setAlignment", lua_Control_setAlignment},
         {"setAlignment", lua_Control_setAlignment},
         {"setAnimationPropertyValue", lua_Control_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Control_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Control_setAutoHeight},
-        {"setAutoWidth", lua_Control_setAutoWidth},
+        {"setAutoSize", lua_Control_setAutoSize},
         {"setBorder", lua_Control_setBorder},
         {"setBorder", lua_Control_setBorder},
         {"setBounds", lua_Control_setBounds},
         {"setBounds", lua_Control_setBounds},
         {"setCanFocus", lua_Control_setCanFocus},
         {"setCanFocus", lua_Control_setCanFocus},
@@ -968,7 +966,7 @@ int lua_Control_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Control_getAutoHeight(lua_State* state)
+int lua_Control_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -981,7 +979,7 @@ int lua_Control_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Control* instance = getInstance(state);
                 Control* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -989,42 +987,7 @@ int lua_Control_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Control_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Control_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Control_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3336,61 +3299,7 @@ int lua_Control_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Control_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Control* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Control* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Control_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Control_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3400,37 +3309,19 @@ int lua_Control_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Control* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Control* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Control* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Control_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Control_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_Control_getAlignment(lua_State* state);
 int lua_Control_getAnimation(lua_State* state);
 int lua_Control_getAnimation(lua_State* state);
 int lua_Control_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Control_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Control_getAnimationPropertyValue(lua_State* state);
 int lua_Control_getAnimationPropertyValue(lua_State* state);
-int lua_Control_getAutoHeight(lua_State* state);
-int lua_Control_getAutoWidth(lua_State* state);
+int lua_Control_getAutoSize(lua_State* state);
 int lua_Control_getBorder(lua_State* state);
 int lua_Control_getBorder(lua_State* state);
 int lua_Control_getBounds(lua_State* state);
 int lua_Control_getBounds(lua_State* state);
 int lua_Control_getClip(lua_State* state);
 int lua_Control_getClip(lua_State* state);
@@ -72,8 +71,7 @@ int lua_Control_removeListener(lua_State* state);
 int lua_Control_removeScriptCallback(lua_State* state);
 int lua_Control_removeScriptCallback(lua_State* state);
 int lua_Control_setAlignment(lua_State* state);
 int lua_Control_setAlignment(lua_State* state);
 int lua_Control_setAnimationPropertyValue(lua_State* state);
 int lua_Control_setAnimationPropertyValue(lua_State* state);
-int lua_Control_setAutoHeight(lua_State* state);
-int lua_Control_setAutoWidth(lua_State* state);
+int lua_Control_setAutoSize(lua_State* state);
 int lua_Control_setBorder(lua_State* state);
 int lua_Control_setBorder(lua_State* state);
 int lua_Control_setBounds(lua_State* state);
 int lua_Control_setBounds(lua_State* state);
 int lua_Control_setCanFocus(lua_State* state);
 int lua_Control_setCanFocus(lua_State* state);

+ 15 - 10
gameplay/src/lua/lua_ControlAutoSize.cpp

@@ -7,17 +7,20 @@ namespace gameplay
 static const char* enumStringEmpty = "";
 static const char* enumStringEmpty = "";
 
 
 static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_NONE = "AUTO_SIZE_NONE";
 static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_NONE = "AUTO_SIZE_NONE";
-static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_STRETCH = "AUTO_SIZE_STRETCH";
-static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_FIT = "AUTO_SIZE_FIT";
+static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_WIDTH = "AUTO_SIZE_WIDTH";
+static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_HEIGHT = "AUTO_SIZE_HEIGHT";
+static const char* luaEnumString_ControlAutoSize_AUTO_SIZE_BOTH = "AUTO_SIZE_BOTH";
 
 
 Control::AutoSize lua_enumFromString_ControlAutoSize(const char* s)
 Control::AutoSize lua_enumFromString_ControlAutoSize(const char* s)
 {
 {
     if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_NONE) == 0)
     if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_NONE) == 0)
         return Control::AUTO_SIZE_NONE;
         return Control::AUTO_SIZE_NONE;
-    if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_STRETCH) == 0)
-        return Control::AUTO_SIZE_STRETCH;
-    if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_FIT) == 0)
-        return Control::AUTO_SIZE_FIT;
+    if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_WIDTH) == 0)
+        return Control::AUTO_SIZE_WIDTH;
+    if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_HEIGHT) == 0)
+        return Control::AUTO_SIZE_HEIGHT;
+    if (strcmp(s, luaEnumString_ControlAutoSize_AUTO_SIZE_BOTH) == 0)
+        return Control::AUTO_SIZE_BOTH;
     return Control::AUTO_SIZE_NONE;
     return Control::AUTO_SIZE_NONE;
 }
 }
 
 
@@ -25,10 +28,12 @@ const char* lua_stringFromEnum_ControlAutoSize(Control::AutoSize e)
 {
 {
     if (e == Control::AUTO_SIZE_NONE)
     if (e == Control::AUTO_SIZE_NONE)
         return luaEnumString_ControlAutoSize_AUTO_SIZE_NONE;
         return luaEnumString_ControlAutoSize_AUTO_SIZE_NONE;
-    if (e == Control::AUTO_SIZE_STRETCH)
-        return luaEnumString_ControlAutoSize_AUTO_SIZE_STRETCH;
-    if (e == Control::AUTO_SIZE_FIT)
-        return luaEnumString_ControlAutoSize_AUTO_SIZE_FIT;
+    if (e == Control::AUTO_SIZE_WIDTH)
+        return luaEnumString_ControlAutoSize_AUTO_SIZE_WIDTH;
+    if (e == Control::AUTO_SIZE_HEIGHT)
+        return luaEnumString_ControlAutoSize_AUTO_SIZE_HEIGHT;
+    if (e == Control::AUTO_SIZE_BOTH)
+        return luaEnumString_ControlAutoSize_AUTO_SIZE_BOTH;
     return enumStringEmpty;
     return enumStringEmpty;
 }
 }
 
 

+ 16 - 125
gameplay/src/lua/lua_Form.cpp

@@ -59,8 +59,7 @@ void luaRegister_Form()
         {"getAnimation", lua_Form_getAnimation},
         {"getAnimation", lua_Form_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Form_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Form_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Form_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Form_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Form_getAutoHeight},
-        {"getAutoWidth", lua_Form_getAutoWidth},
+        {"getAutoSize", lua_Form_getAutoSize},
         {"getBorder", lua_Form_getBorder},
         {"getBorder", lua_Form_getBorder},
         {"getBounds", lua_Form_getBounds},
         {"getBounds", lua_Form_getBounds},
         {"getClip", lua_Form_getClip},
         {"getClip", lua_Form_getClip},
@@ -127,8 +126,7 @@ void luaRegister_Form()
         {"setActiveControl", lua_Form_setActiveControl},
         {"setActiveControl", lua_Form_setActiveControl},
         {"setAlignment", lua_Form_setAlignment},
         {"setAlignment", lua_Form_setAlignment},
         {"setAnimationPropertyValue", lua_Form_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Form_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Form_setAutoHeight},
-        {"setAutoWidth", lua_Form_setAutoWidth},
+        {"setAutoSize", lua_Form_setAutoSize},
         {"setBatchingEnabled", lua_Form_setBatchingEnabled},
         {"setBatchingEnabled", lua_Form_setBatchingEnabled},
         {"setBorder", lua_Form_setBorder},
         {"setBorder", lua_Form_setBorder},
         {"setBounds", lua_Form_setBounds},
         {"setBounds", lua_Form_setBounds},
@@ -1144,7 +1142,7 @@ int lua_Form_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Form_getAutoHeight(lua_State* state)
+int lua_Form_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -1157,7 +1155,7 @@ int lua_Form_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Form* instance = getInstance(state);
                 Form* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1165,42 +1163,7 @@ int lua_Form_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Form_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Form_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Form_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -4153,61 +4116,7 @@ int lua_Form_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Form_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Form* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Form* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Form_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Form_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -4217,37 +4126,19 @@ int lua_Form_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Form* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Form* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Form* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Form_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Form_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -22,8 +22,7 @@ int lua_Form_getAlignment(lua_State* state);
 int lua_Form_getAnimation(lua_State* state);
 int lua_Form_getAnimation(lua_State* state);
 int lua_Form_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Form_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Form_getAnimationPropertyValue(lua_State* state);
 int lua_Form_getAnimationPropertyValue(lua_State* state);
-int lua_Form_getAutoHeight(lua_State* state);
-int lua_Form_getAutoWidth(lua_State* state);
+int lua_Form_getAutoSize(lua_State* state);
 int lua_Form_getBorder(lua_State* state);
 int lua_Form_getBorder(lua_State* state);
 int lua_Form_getBounds(lua_State* state);
 int lua_Form_getBounds(lua_State* state);
 int lua_Form_getClip(lua_State* state);
 int lua_Form_getClip(lua_State* state);
@@ -90,8 +89,7 @@ int lua_Form_removeScriptCallback(lua_State* state);
 int lua_Form_setActiveControl(lua_State* state);
 int lua_Form_setActiveControl(lua_State* state);
 int lua_Form_setAlignment(lua_State* state);
 int lua_Form_setAlignment(lua_State* state);
 int lua_Form_setAnimationPropertyValue(lua_State* state);
 int lua_Form_setAnimationPropertyValue(lua_State* state);
-int lua_Form_setAutoHeight(lua_State* state);
-int lua_Form_setAutoWidth(lua_State* state);
+int lua_Form_setAutoSize(lua_State* state);
 int lua_Form_setBatchingEnabled(lua_State* state);
 int lua_Form_setBatchingEnabled(lua_State* state);
 int lua_Form_setBorder(lua_State* state);
 int lua_Form_setBorder(lua_State* state);
 int lua_Form_setBounds(lua_State* state);
 int lua_Form_setBounds(lua_State* state);

+ 3 - 2
gameplay/src/lua/lua_Global.cpp

@@ -218,8 +218,9 @@ void luaRegister_lua_Global()
         std::vector<std::string> scopePath;
         std::vector<std::string> scopePath;
         scopePath.push_back("Control");
         scopePath.push_back("Control");
         gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_NONE", "AUTO_SIZE_NONE", scopePath);
         gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_NONE", "AUTO_SIZE_NONE", scopePath);
-        gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_STRETCH", "AUTO_SIZE_STRETCH", scopePath);
-        gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_FIT", "AUTO_SIZE_FIT", scopePath);
+        gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_WIDTH", "AUTO_SIZE_WIDTH", scopePath);
+        gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_HEIGHT", "AUTO_SIZE_HEIGHT", scopePath);
+        gameplay::ScriptUtil::registerConstantString("AUTO_SIZE_BOTH", "AUTO_SIZE_BOTH", scopePath);
     }
     }
 
 
     // Register enumeration Control::Listener::EventType.
     // Register enumeration Control::Listener::EventType.

+ 16 - 125
gameplay/src/lua/lua_ImageControl.cpp

@@ -40,8 +40,7 @@ void luaRegister_ImageControl()
         {"getAnimation", lua_ImageControl_getAnimation},
         {"getAnimation", lua_ImageControl_getAnimation},
         {"getAnimationPropertyComponentCount", lua_ImageControl_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_ImageControl_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_ImageControl_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_ImageControl_getAnimationPropertyValue},
-        {"getAutoHeight", lua_ImageControl_getAutoHeight},
-        {"getAutoWidth", lua_ImageControl_getAutoWidth},
+        {"getAutoSize", lua_ImageControl_getAutoSize},
         {"getBorder", lua_ImageControl_getBorder},
         {"getBorder", lua_ImageControl_getBorder},
         {"getBounds", lua_ImageControl_getBounds},
         {"getBounds", lua_ImageControl_getBounds},
         {"getClip", lua_ImageControl_getClip},
         {"getClip", lua_ImageControl_getClip},
@@ -95,8 +94,7 @@ void luaRegister_ImageControl()
         {"removeScriptCallback", lua_ImageControl_removeScriptCallback},
         {"removeScriptCallback", lua_ImageControl_removeScriptCallback},
         {"setAlignment", lua_ImageControl_setAlignment},
         {"setAlignment", lua_ImageControl_setAlignment},
         {"setAnimationPropertyValue", lua_ImageControl_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_ImageControl_setAnimationPropertyValue},
-        {"setAutoHeight", lua_ImageControl_setAutoHeight},
-        {"setAutoWidth", lua_ImageControl_setAutoWidth},
+        {"setAutoSize", lua_ImageControl_setAutoSize},
         {"setBorder", lua_ImageControl_setBorder},
         {"setBorder", lua_ImageControl_setBorder},
         {"setBounds", lua_ImageControl_setBounds},
         {"setBounds", lua_ImageControl_setBounds},
         {"setCanFocus", lua_ImageControl_setCanFocus},
         {"setCanFocus", lua_ImageControl_setCanFocus},
@@ -975,7 +973,7 @@ int lua_ImageControl_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_ImageControl_getAutoHeight(lua_State* state)
+int lua_ImageControl_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -988,7 +986,7 @@ int lua_ImageControl_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 ImageControl* instance = getInstance(state);
                 ImageControl* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -996,42 +994,7 @@ int lua_ImageControl_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_ImageControl_getAutoHeight - 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_ImageControl_getAutoWidth(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))
-            {
-                ImageControl* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ImageControl_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_ImageControl_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3431,61 +3394,7 @@ int lua_ImageControl_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_ImageControl_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    ImageControl* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    ImageControl* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_ImageControl_setAutoHeight - 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_ImageControl_setAutoWidth(lua_State* state)
+int lua_ImageControl_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3495,37 +3404,19 @@ int lua_ImageControl_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    ImageControl* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    ImageControl* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                ImageControl* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_ImageControl_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_ImageControl_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_ImageControl_getAlignment(lua_State* state);
 int lua_ImageControl_getAnimation(lua_State* state);
 int lua_ImageControl_getAnimation(lua_State* state);
 int lua_ImageControl_getAnimationPropertyComponentCount(lua_State* state);
 int lua_ImageControl_getAnimationPropertyComponentCount(lua_State* state);
 int lua_ImageControl_getAnimationPropertyValue(lua_State* state);
 int lua_ImageControl_getAnimationPropertyValue(lua_State* state);
-int lua_ImageControl_getAutoHeight(lua_State* state);
-int lua_ImageControl_getAutoWidth(lua_State* state);
+int lua_ImageControl_getAutoSize(lua_State* state);
 int lua_ImageControl_getBorder(lua_State* state);
 int lua_ImageControl_getBorder(lua_State* state);
 int lua_ImageControl_getBounds(lua_State* state);
 int lua_ImageControl_getBounds(lua_State* state);
 int lua_ImageControl_getClip(lua_State* state);
 int lua_ImageControl_getClip(lua_State* state);
@@ -74,8 +73,7 @@ int lua_ImageControl_removeListener(lua_State* state);
 int lua_ImageControl_removeScriptCallback(lua_State* state);
 int lua_ImageControl_removeScriptCallback(lua_State* state);
 int lua_ImageControl_setAlignment(lua_State* state);
 int lua_ImageControl_setAlignment(lua_State* state);
 int lua_ImageControl_setAnimationPropertyValue(lua_State* state);
 int lua_ImageControl_setAnimationPropertyValue(lua_State* state);
-int lua_ImageControl_setAutoHeight(lua_State* state);
-int lua_ImageControl_setAutoWidth(lua_State* state);
+int lua_ImageControl_setAutoSize(lua_State* state);
 int lua_ImageControl_setBorder(lua_State* state);
 int lua_ImageControl_setBorder(lua_State* state);
 int lua_ImageControl_setBounds(lua_State* state);
 int lua_ImageControl_setBounds(lua_State* state);
 int lua_ImageControl_setCanFocus(lua_State* state);
 int lua_ImageControl_setCanFocus(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_JoystickControl.cpp

@@ -40,8 +40,7 @@ void luaRegister_JoystickControl()
         {"getAnimation", lua_JoystickControl_getAnimation},
         {"getAnimation", lua_JoystickControl_getAnimation},
         {"getAnimationPropertyComponentCount", lua_JoystickControl_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_JoystickControl_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_JoystickControl_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_JoystickControl_getAnimationPropertyValue},
-        {"getAutoHeight", lua_JoystickControl_getAutoHeight},
-        {"getAutoWidth", lua_JoystickControl_getAutoWidth},
+        {"getAutoSize", lua_JoystickControl_getAutoSize},
         {"getBorder", lua_JoystickControl_getBorder},
         {"getBorder", lua_JoystickControl_getBorder},
         {"getBounds", lua_JoystickControl_getBounds},
         {"getBounds", lua_JoystickControl_getBounds},
         {"getClip", lua_JoystickControl_getClip},
         {"getClip", lua_JoystickControl_getClip},
@@ -98,8 +97,7 @@ void luaRegister_JoystickControl()
         {"removeScriptCallback", lua_JoystickControl_removeScriptCallback},
         {"removeScriptCallback", lua_JoystickControl_removeScriptCallback},
         {"setAlignment", lua_JoystickControl_setAlignment},
         {"setAlignment", lua_JoystickControl_setAlignment},
         {"setAnimationPropertyValue", lua_JoystickControl_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_JoystickControl_setAnimationPropertyValue},
-        {"setAutoHeight", lua_JoystickControl_setAutoHeight},
-        {"setAutoWidth", lua_JoystickControl_setAutoWidth},
+        {"setAutoSize", lua_JoystickControl_setAutoSize},
         {"setBorder", lua_JoystickControl_setBorder},
         {"setBorder", lua_JoystickControl_setBorder},
         {"setBounds", lua_JoystickControl_setBounds},
         {"setBounds", lua_JoystickControl_setBounds},
         {"setCanFocus", lua_JoystickControl_setCanFocus},
         {"setCanFocus", lua_JoystickControl_setCanFocus},
@@ -978,7 +976,7 @@ int lua_JoystickControl_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_JoystickControl_getAutoHeight(lua_State* state)
+int lua_JoystickControl_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -991,7 +989,7 @@ int lua_JoystickControl_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 JoystickControl* instance = getInstance(state);
                 JoystickControl* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -999,42 +997,7 @@ int lua_JoystickControl_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_JoystickControl_getAutoHeight - 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_JoystickControl_getAutoWidth(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))
-            {
-                JoystickControl* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_JoystickControl_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_JoystickControl_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3548,61 +3511,7 @@ int lua_JoystickControl_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_JoystickControl_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    JoystickControl* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    JoystickControl* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_JoystickControl_setAutoHeight - 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_JoystickControl_setAutoWidth(lua_State* state)
+int lua_JoystickControl_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3612,37 +3521,19 @@ int lua_JoystickControl_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    JoystickControl* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    JoystickControl* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                JoystickControl* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_JoystickControl_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_JoystickControl_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_JoystickControl_getAlignment(lua_State* state);
 int lua_JoystickControl_getAnimation(lua_State* state);
 int lua_JoystickControl_getAnimation(lua_State* state);
 int lua_JoystickControl_getAnimationPropertyComponentCount(lua_State* state);
 int lua_JoystickControl_getAnimationPropertyComponentCount(lua_State* state);
 int lua_JoystickControl_getAnimationPropertyValue(lua_State* state);
 int lua_JoystickControl_getAnimationPropertyValue(lua_State* state);
-int lua_JoystickControl_getAutoHeight(lua_State* state);
-int lua_JoystickControl_getAutoWidth(lua_State* state);
+int lua_JoystickControl_getAutoSize(lua_State* state);
 int lua_JoystickControl_getBorder(lua_State* state);
 int lua_JoystickControl_getBorder(lua_State* state);
 int lua_JoystickControl_getBounds(lua_State* state);
 int lua_JoystickControl_getBounds(lua_State* state);
 int lua_JoystickControl_getClip(lua_State* state);
 int lua_JoystickControl_getClip(lua_State* state);
@@ -77,8 +76,7 @@ int lua_JoystickControl_removeListener(lua_State* state);
 int lua_JoystickControl_removeScriptCallback(lua_State* state);
 int lua_JoystickControl_removeScriptCallback(lua_State* state);
 int lua_JoystickControl_setAlignment(lua_State* state);
 int lua_JoystickControl_setAlignment(lua_State* state);
 int lua_JoystickControl_setAnimationPropertyValue(lua_State* state);
 int lua_JoystickControl_setAnimationPropertyValue(lua_State* state);
-int lua_JoystickControl_setAutoHeight(lua_State* state);
-int lua_JoystickControl_setAutoWidth(lua_State* state);
+int lua_JoystickControl_setAutoSize(lua_State* state);
 int lua_JoystickControl_setBorder(lua_State* state);
 int lua_JoystickControl_setBorder(lua_State* state);
 int lua_JoystickControl_setBounds(lua_State* state);
 int lua_JoystickControl_setBounds(lua_State* state);
 int lua_JoystickControl_setCanFocus(lua_State* state);
 int lua_JoystickControl_setCanFocus(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_Label.cpp

@@ -40,8 +40,7 @@ void luaRegister_Label()
         {"getAnimation", lua_Label_getAnimation},
         {"getAnimation", lua_Label_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Label_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Label_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Label_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Label_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Label_getAutoHeight},
-        {"getAutoWidth", lua_Label_getAutoWidth},
+        {"getAutoSize", lua_Label_getAutoSize},
         {"getBorder", lua_Label_getBorder},
         {"getBorder", lua_Label_getBorder},
         {"getBounds", lua_Label_getBounds},
         {"getBounds", lua_Label_getBounds},
         {"getClip", lua_Label_getClip},
         {"getClip", lua_Label_getClip},
@@ -94,8 +93,7 @@ void luaRegister_Label()
         {"removeScriptCallback", lua_Label_removeScriptCallback},
         {"removeScriptCallback", lua_Label_removeScriptCallback},
         {"setAlignment", lua_Label_setAlignment},
         {"setAlignment", lua_Label_setAlignment},
         {"setAnimationPropertyValue", lua_Label_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Label_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Label_setAutoHeight},
-        {"setAutoWidth", lua_Label_setAutoWidth},
+        {"setAutoSize", lua_Label_setAutoSize},
         {"setBorder", lua_Label_setBorder},
         {"setBorder", lua_Label_setBorder},
         {"setBounds", lua_Label_setBounds},
         {"setBounds", lua_Label_setBounds},
         {"setCanFocus", lua_Label_setCanFocus},
         {"setCanFocus", lua_Label_setCanFocus},
@@ -972,7 +970,7 @@ int lua_Label_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Label_getAutoHeight(lua_State* state)
+int lua_Label_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -985,7 +983,7 @@ int lua_Label_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Label* instance = getInstance(state);
                 Label* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -993,42 +991,7 @@ int lua_Label_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Label_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Label_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Label_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3375,61 +3338,7 @@ int lua_Label_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Label_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Label* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Label* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Label_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Label_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3439,37 +3348,19 @@ int lua_Label_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Label* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Label* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Label* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Label_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Label_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_Label_getAlignment(lua_State* state);
 int lua_Label_getAnimation(lua_State* state);
 int lua_Label_getAnimation(lua_State* state);
 int lua_Label_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Label_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Label_getAnimationPropertyValue(lua_State* state);
 int lua_Label_getAnimationPropertyValue(lua_State* state);
-int lua_Label_getAutoHeight(lua_State* state);
-int lua_Label_getAutoWidth(lua_State* state);
+int lua_Label_getAutoSize(lua_State* state);
 int lua_Label_getBorder(lua_State* state);
 int lua_Label_getBorder(lua_State* state);
 int lua_Label_getBounds(lua_State* state);
 int lua_Label_getBounds(lua_State* state);
 int lua_Label_getClip(lua_State* state);
 int lua_Label_getClip(lua_State* state);
@@ -73,8 +72,7 @@ int lua_Label_removeListener(lua_State* state);
 int lua_Label_removeScriptCallback(lua_State* state);
 int lua_Label_removeScriptCallback(lua_State* state);
 int lua_Label_setAlignment(lua_State* state);
 int lua_Label_setAlignment(lua_State* state);
 int lua_Label_setAnimationPropertyValue(lua_State* state);
 int lua_Label_setAnimationPropertyValue(lua_State* state);
-int lua_Label_setAutoHeight(lua_State* state);
-int lua_Label_setAutoWidth(lua_State* state);
+int lua_Label_setAutoSize(lua_State* state);
 int lua_Label_setBorder(lua_State* state);
 int lua_Label_setBorder(lua_State* state);
 int lua_Label_setBounds(lua_State* state);
 int lua_Label_setBounds(lua_State* state);
 int lua_Label_setCanFocus(lua_State* state);
 int lua_Label_setCanFocus(lua_State* state);

+ 16 - 211
gameplay/src/lua/lua_RadioButton.cpp

@@ -43,8 +43,7 @@ void luaRegister_RadioButton()
         {"getAnimation", lua_RadioButton_getAnimation},
         {"getAnimation", lua_RadioButton_getAnimation},
         {"getAnimationPropertyComponentCount", lua_RadioButton_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_RadioButton_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_RadioButton_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_RadioButton_getAnimationPropertyValue},
-        {"getAutoHeight", lua_RadioButton_getAutoHeight},
-        {"getAutoWidth", lua_RadioButton_getAutoWidth},
+        {"getAutoSize", lua_RadioButton_getAutoSize},
         {"getBorder", lua_RadioButton_getBorder},
         {"getBorder", lua_RadioButton_getBorder},
         {"getBounds", lua_RadioButton_getBounds},
         {"getBounds", lua_RadioButton_getBounds},
         {"getClip", lua_RadioButton_getClip},
         {"getClip", lua_RadioButton_getClip},
@@ -61,7 +60,6 @@ void luaRegister_RadioButton()
         {"getId", lua_RadioButton_getId},
         {"getId", lua_RadioButton_getId},
         {"getImageColor", lua_RadioButton_getImageColor},
         {"getImageColor", lua_RadioButton_getImageColor},
         {"getImageRegion", lua_RadioButton_getImageRegion},
         {"getImageRegion", lua_RadioButton_getImageRegion},
-        {"getImageSize", lua_RadioButton_getImageSize},
         {"getImageUVs", lua_RadioButton_getImageUVs},
         {"getImageUVs", lua_RadioButton_getImageUVs},
         {"getMargin", lua_RadioButton_getMargin},
         {"getMargin", lua_RadioButton_getMargin},
         {"getOpacity", lua_RadioButton_getOpacity},
         {"getOpacity", lua_RadioButton_getOpacity},
@@ -100,8 +98,7 @@ void luaRegister_RadioButton()
         {"removeScriptCallback", lua_RadioButton_removeScriptCallback},
         {"removeScriptCallback", lua_RadioButton_removeScriptCallback},
         {"setAlignment", lua_RadioButton_setAlignment},
         {"setAlignment", lua_RadioButton_setAlignment},
         {"setAnimationPropertyValue", lua_RadioButton_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_RadioButton_setAnimationPropertyValue},
-        {"setAutoHeight", lua_RadioButton_setAutoHeight},
-        {"setAutoWidth", lua_RadioButton_setAutoWidth},
+        {"setAutoSize", lua_RadioButton_setAutoSize},
         {"setBorder", lua_RadioButton_setBorder},
         {"setBorder", lua_RadioButton_setBorder},
         {"setBounds", lua_RadioButton_setBounds},
         {"setBounds", lua_RadioButton_setBounds},
         {"setCanFocus", lua_RadioButton_setCanFocus},
         {"setCanFocus", lua_RadioButton_setCanFocus},
@@ -118,7 +115,6 @@ void luaRegister_RadioButton()
         {"setId", lua_RadioButton_setId},
         {"setId", lua_RadioButton_setId},
         {"setImageColor", lua_RadioButton_setImageColor},
         {"setImageColor", lua_RadioButton_setImageColor},
         {"setImageRegion", lua_RadioButton_setImageRegion},
         {"setImageRegion", lua_RadioButton_setImageRegion},
-        {"setImageSize", lua_RadioButton_setImageSize},
         {"setMargin", lua_RadioButton_setMargin},
         {"setMargin", lua_RadioButton_setMargin},
         {"setOpacity", lua_RadioButton_setOpacity},
         {"setOpacity", lua_RadioButton_setOpacity},
         {"setPadding", lua_RadioButton_setPadding},
         {"setPadding", lua_RadioButton_setPadding},
@@ -981,7 +977,7 @@ int lua_RadioButton_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_RadioButton_getAutoHeight(lua_State* state)
+int lua_RadioButton_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -994,7 +990,7 @@ int lua_RadioButton_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 RadioButton* instance = getInstance(state);
                 RadioButton* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1002,42 +998,7 @@ int lua_RadioButton_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_RadioButton_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_RadioButton_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -1810,50 +1771,6 @@ int lua_RadioButton_getImageRegion(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_RadioButton_getImageSize(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);
-                void* returnPtr = (void*)&(instance->getImageSize());
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Vector2");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_getImageSize - 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_getImageUVs(lua_State* state)
 int lua_RadioButton_getImageUVs(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
@@ -3498,7 +3415,7 @@ int lua_RadioButton_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_RadioButton_setAutoHeight(lua_State* state)
+int lua_RadioButton_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3508,91 +3425,19 @@ int lua_RadioButton_setAutoHeight(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    RadioButton* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    RadioButton* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_RadioButton_setAutoHeight - 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_setAutoWidth(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    RadioButton* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    RadioButton* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                RadioButton* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_RadioButton_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_RadioButton_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -4415,46 +4260,6 @@ int lua_RadioButton_setImageRegion(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_RadioButton_setImageSize(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_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
-
-                RadioButton* instance = getInstance(state);
-                instance->setImageSize(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_setImageSize - 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_RadioButton_setMargin(lua_State* state)
 int lua_RadioButton_setMargin(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.

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

@@ -19,8 +19,7 @@ int lua_RadioButton_getAlignment(lua_State* state);
 int lua_RadioButton_getAnimation(lua_State* state);
 int lua_RadioButton_getAnimation(lua_State* state);
 int lua_RadioButton_getAnimationPropertyComponentCount(lua_State* state);
 int lua_RadioButton_getAnimationPropertyComponentCount(lua_State* state);
 int lua_RadioButton_getAnimationPropertyValue(lua_State* state);
 int lua_RadioButton_getAnimationPropertyValue(lua_State* state);
-int lua_RadioButton_getAutoHeight(lua_State* state);
-int lua_RadioButton_getAutoWidth(lua_State* state);
+int lua_RadioButton_getAutoSize(lua_State* state);
 int lua_RadioButton_getBorder(lua_State* state);
 int lua_RadioButton_getBorder(lua_State* state);
 int lua_RadioButton_getBounds(lua_State* state);
 int lua_RadioButton_getBounds(lua_State* state);
 int lua_RadioButton_getClip(lua_State* state);
 int lua_RadioButton_getClip(lua_State* state);
@@ -37,7 +36,6 @@ int lua_RadioButton_getHeight(lua_State* state);
 int lua_RadioButton_getId(lua_State* state);
 int lua_RadioButton_getId(lua_State* state);
 int lua_RadioButton_getImageColor(lua_State* state);
 int lua_RadioButton_getImageColor(lua_State* state);
 int lua_RadioButton_getImageRegion(lua_State* state);
 int lua_RadioButton_getImageRegion(lua_State* state);
-int lua_RadioButton_getImageSize(lua_State* state);
 int lua_RadioButton_getImageUVs(lua_State* state);
 int lua_RadioButton_getImageUVs(lua_State* state);
 int lua_RadioButton_getMargin(lua_State* state);
 int lua_RadioButton_getMargin(lua_State* state);
 int lua_RadioButton_getOpacity(lua_State* state);
 int lua_RadioButton_getOpacity(lua_State* state);
@@ -76,8 +74,7 @@ int lua_RadioButton_removeListener(lua_State* state);
 int lua_RadioButton_removeScriptCallback(lua_State* state);
 int lua_RadioButton_removeScriptCallback(lua_State* state);
 int lua_RadioButton_setAlignment(lua_State* state);
 int lua_RadioButton_setAlignment(lua_State* state);
 int lua_RadioButton_setAnimationPropertyValue(lua_State* state);
 int lua_RadioButton_setAnimationPropertyValue(lua_State* state);
-int lua_RadioButton_setAutoHeight(lua_State* state);
-int lua_RadioButton_setAutoWidth(lua_State* state);
+int lua_RadioButton_setAutoSize(lua_State* state);
 int lua_RadioButton_setBorder(lua_State* state);
 int lua_RadioButton_setBorder(lua_State* state);
 int lua_RadioButton_setBounds(lua_State* state);
 int lua_RadioButton_setBounds(lua_State* state);
 int lua_RadioButton_setCanFocus(lua_State* state);
 int lua_RadioButton_setCanFocus(lua_State* state);
@@ -94,7 +91,6 @@ int lua_RadioButton_setHeight(lua_State* state);
 int lua_RadioButton_setId(lua_State* state);
 int lua_RadioButton_setId(lua_State* state);
 int lua_RadioButton_setImageColor(lua_State* state);
 int lua_RadioButton_setImageColor(lua_State* state);
 int lua_RadioButton_setImageRegion(lua_State* state);
 int lua_RadioButton_setImageRegion(lua_State* state);
-int lua_RadioButton_setImageSize(lua_State* state);
 int lua_RadioButton_setMargin(lua_State* state);
 int lua_RadioButton_setMargin(lua_State* state);
 int lua_RadioButton_setOpacity(lua_State* state);
 int lua_RadioButton_setOpacity(lua_State* state);
 int lua_RadioButton_setPadding(lua_State* state);
 int lua_RadioButton_setPadding(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_Slider.cpp

@@ -41,8 +41,7 @@ void luaRegister_Slider()
         {"getAnimation", lua_Slider_getAnimation},
         {"getAnimation", lua_Slider_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Slider_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_Slider_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_Slider_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_Slider_getAnimationPropertyValue},
-        {"getAutoHeight", lua_Slider_getAutoHeight},
-        {"getAutoWidth", lua_Slider_getAutoWidth},
+        {"getAutoSize", lua_Slider_getAutoSize},
         {"getBorder", lua_Slider_getBorder},
         {"getBorder", lua_Slider_getBorder},
         {"getBounds", lua_Slider_getBounds},
         {"getBounds", lua_Slider_getBounds},
         {"getClip", lua_Slider_getClip},
         {"getClip", lua_Slider_getClip},
@@ -102,8 +101,7 @@ void luaRegister_Slider()
         {"removeScriptCallback", lua_Slider_removeScriptCallback},
         {"removeScriptCallback", lua_Slider_removeScriptCallback},
         {"setAlignment", lua_Slider_setAlignment},
         {"setAlignment", lua_Slider_setAlignment},
         {"setAnimationPropertyValue", lua_Slider_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_Slider_setAnimationPropertyValue},
-        {"setAutoHeight", lua_Slider_setAutoHeight},
-        {"setAutoWidth", lua_Slider_setAutoWidth},
+        {"setAutoSize", lua_Slider_setAutoSize},
         {"setBorder", lua_Slider_setBorder},
         {"setBorder", lua_Slider_setBorder},
         {"setBounds", lua_Slider_setBounds},
         {"setBounds", lua_Slider_setBounds},
         {"setCanFocus", lua_Slider_setCanFocus},
         {"setCanFocus", lua_Slider_setCanFocus},
@@ -987,7 +985,7 @@ int lua_Slider_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Slider_getAutoHeight(lua_State* state)
+int lua_Slider_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -1000,7 +998,7 @@ int lua_Slider_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 Slider* instance = getInstance(state);
                 Slider* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1008,42 +1006,7 @@ int lua_Slider_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_Slider_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Slider_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Slider_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3635,61 +3598,7 @@ int lua_Slider_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_Slider_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Slider* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    Slider* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_Slider_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_Slider_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3699,37 +3608,19 @@ int lua_Slider_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    Slider* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    Slider* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                Slider* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_Slider_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_Slider_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_Slider_getAlignment(lua_State* state);
 int lua_Slider_getAnimation(lua_State* state);
 int lua_Slider_getAnimation(lua_State* state);
 int lua_Slider_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Slider_getAnimationPropertyComponentCount(lua_State* state);
 int lua_Slider_getAnimationPropertyValue(lua_State* state);
 int lua_Slider_getAnimationPropertyValue(lua_State* state);
-int lua_Slider_getAutoHeight(lua_State* state);
-int lua_Slider_getAutoWidth(lua_State* state);
+int lua_Slider_getAutoSize(lua_State* state);
 int lua_Slider_getBorder(lua_State* state);
 int lua_Slider_getBorder(lua_State* state);
 int lua_Slider_getBounds(lua_State* state);
 int lua_Slider_getBounds(lua_State* state);
 int lua_Slider_getClip(lua_State* state);
 int lua_Slider_getClip(lua_State* state);
@@ -80,8 +79,7 @@ int lua_Slider_removeListener(lua_State* state);
 int lua_Slider_removeScriptCallback(lua_State* state);
 int lua_Slider_removeScriptCallback(lua_State* state);
 int lua_Slider_setAlignment(lua_State* state);
 int lua_Slider_setAlignment(lua_State* state);
 int lua_Slider_setAnimationPropertyValue(lua_State* state);
 int lua_Slider_setAnimationPropertyValue(lua_State* state);
-int lua_Slider_setAutoHeight(lua_State* state);
-int lua_Slider_setAutoWidth(lua_State* state);
+int lua_Slider_setAutoSize(lua_State* state);
 int lua_Slider_setBorder(lua_State* state);
 int lua_Slider_setBorder(lua_State* state);
 int lua_Slider_setBounds(lua_State* state);
 int lua_Slider_setBounds(lua_State* state);
 int lua_Slider_setCanFocus(lua_State* state);
 int lua_Slider_setCanFocus(lua_State* state);

+ 16 - 125
gameplay/src/lua/lua_TextBox.cpp

@@ -42,8 +42,7 @@ void luaRegister_TextBox()
         {"getAnimation", lua_TextBox_getAnimation},
         {"getAnimation", lua_TextBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_TextBox_getAnimationPropertyComponentCount},
         {"getAnimationPropertyComponentCount", lua_TextBox_getAnimationPropertyComponentCount},
         {"getAnimationPropertyValue", lua_TextBox_getAnimationPropertyValue},
         {"getAnimationPropertyValue", lua_TextBox_getAnimationPropertyValue},
-        {"getAutoHeight", lua_TextBox_getAutoHeight},
-        {"getAutoWidth", lua_TextBox_getAutoWidth},
+        {"getAutoSize", lua_TextBox_getAutoSize},
         {"getBorder", lua_TextBox_getBorder},
         {"getBorder", lua_TextBox_getBorder},
         {"getBounds", lua_TextBox_getBounds},
         {"getBounds", lua_TextBox_getBounds},
         {"getCaretLocation", lua_TextBox_getCaretLocation},
         {"getCaretLocation", lua_TextBox_getCaretLocation},
@@ -100,8 +99,7 @@ void luaRegister_TextBox()
         {"removeScriptCallback", lua_TextBox_removeScriptCallback},
         {"removeScriptCallback", lua_TextBox_removeScriptCallback},
         {"setAlignment", lua_TextBox_setAlignment},
         {"setAlignment", lua_TextBox_setAlignment},
         {"setAnimationPropertyValue", lua_TextBox_setAnimationPropertyValue},
         {"setAnimationPropertyValue", lua_TextBox_setAnimationPropertyValue},
-        {"setAutoHeight", lua_TextBox_setAutoHeight},
-        {"setAutoWidth", lua_TextBox_setAutoWidth},
+        {"setAutoSize", lua_TextBox_setAutoSize},
         {"setBorder", lua_TextBox_setBorder},
         {"setBorder", lua_TextBox_setBorder},
         {"setBounds", lua_TextBox_setBounds},
         {"setBounds", lua_TextBox_setBounds},
         {"setCanFocus", lua_TextBox_setCanFocus},
         {"setCanFocus", lua_TextBox_setCanFocus},
@@ -981,7 +979,7 @@ int lua_TextBox_getAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_TextBox_getAutoHeight(lua_State* state)
+int lua_TextBox_getAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -994,7 +992,7 @@ int lua_TextBox_getAutoHeight(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
             {
                 TextBox* instance = getInstance(state);
                 TextBox* instance = getInstance(state);
-                Control::AutoSize result = instance->getAutoHeight();
+                Control::AutoSize result = instance->getAutoSize();
 
 
                 // Push the return value onto the stack.
                 // Push the return value onto the stack.
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
                 lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
@@ -1002,42 +1000,7 @@ int lua_TextBox_getAutoHeight(lua_State* state)
                 return 1;
                 return 1;
             }
             }
 
 
-            lua_pushstring(state, "lua_TextBox_getAutoHeight - 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_getAutoWidth(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);
-                Control::AutoSize result = instance->getAutoWidth();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_ControlAutoSize(result));
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_TextBox_getAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_TextBox_getAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }
@@ -3524,61 +3487,7 @@ int lua_TextBox_setAnimationPropertyValue(lua_State* state)
     return 0;
     return 0;
 }
 }
 
 
-int lua_TextBox_setAutoHeight(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:
-        {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    TextBox* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
-
-                    TextBox* instance = getInstance(state);
-                    instance->setAutoHeight(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            lua_pushstring(state, "lua_TextBox_setAutoHeight - 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_setAutoWidth(lua_State* state)
+int lua_TextBox_setAutoSize(lua_State* state)
 {
 {
     // Get the number of parameters.
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
     int paramCount = lua_gettop(state);
@@ -3588,37 +3497,19 @@ int lua_TextBox_setAutoWidth(lua_State* state)
     {
     {
         case 2:
         case 2:
         {
         {
-            do
-            {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    lua_type(state, 2) == LUA_TBOOLEAN)
-                {
-                    // Get parameter 1 off the stack.
-                    bool param1 = gameplay::ScriptUtil::luaCheckBool(state, 2);
-
-                    TextBox* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
-
-            do
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
             {
-                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-                {
-                    // Get parameter 1 off the stack.
-                    Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
+                // Get parameter 1 off the stack.
+                Control::AutoSize param1 = (Control::AutoSize)lua_enumFromString_ControlAutoSize(luaL_checkstring(state, 2));
 
 
-                    TextBox* instance = getInstance(state);
-                    instance->setAutoWidth(param1);
-                    
-                    return 0;
-                }
-            } while (0);
+                TextBox* instance = getInstance(state);
+                instance->setAutoSize(param1);
+                
+                return 0;
+            }
 
 
-            lua_pushstring(state, "lua_TextBox_setAutoWidth - Failed to match the given parameters to a valid function signature.");
+            lua_pushstring(state, "lua_TextBox_setAutoSize - Failed to match the given parameters to a valid function signature.");
             lua_error(state);
             lua_error(state);
             break;
             break;
         }
         }

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

@@ -19,8 +19,7 @@ int lua_TextBox_getAlignment(lua_State* state);
 int lua_TextBox_getAnimation(lua_State* state);
 int lua_TextBox_getAnimation(lua_State* state);
 int lua_TextBox_getAnimationPropertyComponentCount(lua_State* state);
 int lua_TextBox_getAnimationPropertyComponentCount(lua_State* state);
 int lua_TextBox_getAnimationPropertyValue(lua_State* state);
 int lua_TextBox_getAnimationPropertyValue(lua_State* state);
-int lua_TextBox_getAutoHeight(lua_State* state);
-int lua_TextBox_getAutoWidth(lua_State* state);
+int lua_TextBox_getAutoSize(lua_State* state);
 int lua_TextBox_getBorder(lua_State* state);
 int lua_TextBox_getBorder(lua_State* state);
 int lua_TextBox_getBounds(lua_State* state);
 int lua_TextBox_getBounds(lua_State* state);
 int lua_TextBox_getCaretLocation(lua_State* state);
 int lua_TextBox_getCaretLocation(lua_State* state);
@@ -77,8 +76,7 @@ int lua_TextBox_removeListener(lua_State* state);
 int lua_TextBox_removeScriptCallback(lua_State* state);
 int lua_TextBox_removeScriptCallback(lua_State* state);
 int lua_TextBox_setAlignment(lua_State* state);
 int lua_TextBox_setAlignment(lua_State* state);
 int lua_TextBox_setAnimationPropertyValue(lua_State* state);
 int lua_TextBox_setAnimationPropertyValue(lua_State* state);
-int lua_TextBox_setAutoHeight(lua_State* state);
-int lua_TextBox_setAutoWidth(lua_State* state);
+int lua_TextBox_setAutoSize(lua_State* state);
 int lua_TextBox_setBorder(lua_State* state);
 int lua_TextBox_setBorder(lua_State* state);
 int lua_TextBox_setBounds(lua_State* state);
 int lua_TextBox_setBounds(lua_State* state);
 int lua_TextBox_setCanFocus(lua_State* state);
 int lua_TextBox_setCanFocus(lua_State* state);

+ 1 - 1
samples/browser/game.config

@@ -19,5 +19,5 @@ gamepad
 
 
 ui
 ui
 {
 {
-    defaultTheme = res/common/default.theme
+    theme = res/ui/default.theme
 }
 }

+ 0 - 414
samples/browser/res/common/default.theme

@@ -1,414 +0,0 @@
-theme mainMenu
-{
-    texture = res/png/default-theme.png
-
-    imageList normalImages
-    {
-        color = #4A8799ff
-
-        image unchecked
-        {
-            region = 78, 1, 46, 46
-        }
-
-        image checked
-        {
-            region = 78, 46, 46, 46
-        }
-
-        image unselected
-        {
-            region = 127, 1, 46, 46
-        }
-
-        image selected
-        {
-            region = 127, 46, 46, 46
-        }
-
-        image minCap
-        {
-            region = 3, 115, 8, 11
-        }
-
-        image maxCap
-        {
-            region = 3, 115, 8, 11
-        }
-
-        image marker
-        {
-            region = 16, 113, 18, 18
-        }
-
-        image track
-        {
-            region = 42, 119, 26, 6
-        }
-
-        image textCaret
-        {
-            region = 5, 149, 11, 25
-            color = #C3D9BFff
-        }
-
-        image scrollBarTopCap
-        {
-            region = 0, 99, 12, 5
-        }
-
-        image verticalScrollBar
-        {
-            region = 0, 104, 12, 19
-        }
-
-        image scrollBarBottomCap
-        {
-            region = 0, 138, 12, 5
-        }
-
-        image scrollBarLeftCap
-        {
-            region = 35, 115, 5, 12
-        }
-
-        image horizontalScrollBar
-        {
-            region = 43, 115, 19, 12
-        }
-
-        image scrollBarRightCap
-        {
-            region = 65, 115, 5, 12
-        }
-    }
-
-    imageList activeImages : normalImages
-    {
-        color = #C3D9BFff
-
-        image unchecked
-        {
-            region = 78, 91, 46, 46
-        }
-
-        image checked
-        {
-            region = 78, 91, 46, 46
-        }
-
-        image unselected
-        {
-            region = 127, 91, 46, 46
-        }
-
-        image selected
-        {
-            region = 127, 91, 46, 46
-        }
-    }
-
-    skin mainNormal
-    {
-        border
-        {
-            left = 10
-            right = 10
-            top = 10
-            bottom = 10
-        }
-        
-        region = 1, 1, 74, 74
-        color = #4A8799ff
-    }
-
-    skin mainActive : mainNormal
-    {
-        color = #C3D9BFff
-    }
-
-	skin mainFocus : mainNormal
-	{
-		color = #2A6779ff
-	}
-
-    skin formEntry : mainNormal
-    {
-        region = 78, 1, 46, 46
-        color = #35535Cff
-    }
-
-	skin formFocus : formEntry
-	{
-        color = #15333Cff
-	}
-    
-    skin underliner
-    {
-        border
-        {
-            bottom = 10
-        }
-        
-        region = 4, 82, 68, 5
-        color = #ffffffff
-    }
-
-    skin plusNormal
-    {
-        region = 81, 139, 40, 40
-        color = #4A8799ff
-    }
-
-    skin plusActive : plusNormal
-    {
-        color = #C3D9BFff
-    }
-
-    skin minusNormal
-    {
-        region = 81, 184, 40, 40
-        color = #4A8799ff
-    }
-
-    skin minusActive : minusNormal
-    {
-        color = #C3D9BFff
-    }
-
-    style plus
-    {
-        stateNormal
-        {
-            skin = plusNormal
-        }
-
-        stateActive
-        {
-            skin = plusActive
-        }
-    }
-
-    style minus
-    {
-        stateNormal
-        {
-            skin = minusNormal
-        }
-
-        stateActive
-        {
-            skin = minusActive
-        }
-    }
-
-    style underlined
-    {
-        padding
-        {
-            top = 5
-        }
-    
-        stateNormal
-        {
-            skin = underliner
-            textColor = #ffffffff
-            font = res/ui/arial.gpb
-            fontSize = 16
-            textAlignment = ALIGN_BOTTOM_HCENTER
-        }
-    }
-
-    style leftAlignedUnderlined : underlined
-    {
-        stateNormal
-        {
-            textAlignment = ALIGN_TOP_LEFT
-        }
-    }
-	
-	style basicContainer
-	{
-		stateNormal
-        {
-            skin = mainNormal
-            imageList = normalImages
-
-            font = res/ui/arial.gpb
-            textColor = #ffffffff
-            fontSize = 16
-            textAlignment = ALIGN_VCENTER_HCENTER
-        }
-
-		stateFocus
-		{
-			skin = mainFocus
-		}
-		
-		stateDisabled
-		{
-			opacity = 0.6
-		}
-	}
-
-    style basic : basicContainer
-    {
-        stateActive
-        {
-            imageList = activeImages
-        }
-		
-		stateFocus
-		{
-			skin = mainNormal
-			textColor = #aaa000ff
-		}
-    }
-
-    style topLeftAlignedEntry : basic
-    {
-        stateNormal
-        {
-            skin = formEntry
-            textAlignment = ALIGN_TOP_LEFT
-        }
-
-        stateFocus
-        {
-            skin = formFocus
-        }
-    }
-
-    style buttonStyle : basic
-    {
-        padding
-        {
-            top = -10
-            bottom = -10
-        }
-
-        stateNormal
-        {
-            font = res/ui/arial.gpb
-            fontSize = 16
-        }
-
-        stateActive
-        {
-            skin = mainActive
-        }
-    }
-	
-	style buttonHover : buttonStyle
-	{
-		stateHover
-		{
-			textColor = #ff0000ff
-		}
-	}
-
-    style noBorder
-    {
-        stateNormal
-        {
-            imageList = normalImages
-            font = res/ui/arial.gpb
-            textColor = #ffffffff
-            fontSize = 16
-            textAlignment = ALIGN_VCENTER_HCENTER
-        }
-		
-		stateFocus
-		{
-			textColor = #aaa000ff
-		}
-
-        stateActive
-        {
-            imageList = activeImages
-            textAlignment = ALIGN_VCENTER_HCENTER
-        }
-    }
-
-    style iconNoBorder : noBorder
-    {
-        stateNormal
-        {
-            font = res/ui/arial.gpb
-            fontSize = 16
-            textAlignment = ALIGN_VCENTER_LEFT
-        }
-
-        stateActive
-        {
-            font = res/ui/arial.gpb
-            fontSize = 16
-            textAlignment = ALIGN_VCENTER_LEFT
-        }
-    }
-
-    style topLeftNoBorder : iconNoBorder
-    {
-        stateNormal
-        {
-            textAlignment = ALIGN_TOP_LEFT
-        }
-
-        stateActive
-        {
-            textAlignment = ALIGN_TOP_LEFT
-        }
-    }
-
-    style title
-    {
-        stateNormal
-        {
-            textColor = #ffffffff
-            font = res/ui/arial.gpb
-            fontSize = 24
-            textAlignment = ALIGN_BOTTOM_HCENTER
-        }
-
-        stateActive
-        {
-            textColor = #C3D9BFff
-        }
-    }
-
-    style Form : basicContainer
-    {
-    }
-
-    style Container
-    {
-    }
-
-    style Label : iconNoBorder
-    {
-    }
-
-    style Button : buttonStyle
-    {
-    }
-
-    style CheckBox : iconNoBorder
-    {
-    }
-
-    style RadioButton : iconNoBorder
-    {
-    }
-
-    style TextBox : topLeftAlignedEntry
-    {
-    }
-
-    style Slider : topLeftNoBorder
-    {
-    }
-
-    style Image
-    {
-    }
-}

+ 28 - 34
samples/browser/res/common/forms/formBasicControls.form

@@ -2,34 +2,31 @@ form basicControls
 {
 {
     layout = LAYOUT_ABSOLUTE
     layout = LAYOUT_ABSOLUTE
     size = 600, 600
     size = 600, 600
-	consumeInputEvents = true
     batchingEnabled = false
     batchingEnabled = false
-    	
+
 	label title
 	label title
 	{
 	{
-		position = 185, 0
-		size = 200, 50
-		text = This is a label.
+		position = 185, 10
+		text = Title Label
+        fontSize = 32
 	}
 	}
 		
 		
 	button testButton
 	button testButton
 	{
 	{
-		position = 20, 80
-		size = 200, 100
-		text = This is a button with a hover state.
+		position = 20, 110
+		text = This is a button
 	}
 	}
 
 
 	checkbox testCheckbox
 	checkbox testCheckbox
 	{
 	{
 		position = 20, 220
 		position = 20, 220
-		size = 200, 40
 		text = This is a checkbox.
 		text = This is a checkbox.
 	}
 	}
 	
 	
 	slider testSlider
 	slider testSlider
 	{
 	{
-		position = 25, 315
-		size = 190, 60
+        position = 25, 315
+		width = 190
 		orientation = HORIZONTAL
 		orientation = HORIZONTAL
 		min = -100
 		min = -100
 		max = 100
 		max = 100
@@ -37,47 +34,39 @@ form basicControls
 		//step = 5
 		//step = 5
 		text = This is a slider.
 		text = This is a slider.
 		valueTextVisible = true
 		valueTextVisible = true
-		consumeInputEvents = true
 	}
 	}
 
 
     label textBoxLabel
     label textBoxLabel
     {
     {
-        //style = iconNoBorder
-        position = 25, 400
+        position = 25, 390
         size = 200, 60
         size = 200, 60
-        text = Label:
+        text = This is a label:
     }
     }
 
 
     textBox testTextBox
     textBox testTextBox
     {
     {
-        position = 20, 450
+        position = 20, 430
         size = 250, 80
         size = 250, 80
         text = This is a text box.
         text = This is a text box.
-		consumeInputEvents = true
     }
     }
 
 
     textBox testPasswordTextBox
     textBox testPasswordTextBox
     {
     {
-        position = 20, 540
-        size = 250, 40
+        position = 20, 520
+        width = 250
         text = PASSWORD
         text = PASSWORD
-        consumeInputEvents = true
         inputMode = PASSWORD
         inputMode = PASSWORD
     }
     }
 
 
 	container radioButtonContainer
 	container radioButtonContainer
 	{
 	{
 		layout = LAYOUT_VERTICAL
 		layout = LAYOUT_VERTICAL
-		position = 330, 75
-		autoWidth = AUTO_SIZE_FIT
-        autoHeight = AUTO_SIZE_FIT
+		position = 330, 100
 
 
 		radioButton choice1
 		radioButton choice1
 		{
 		{
 			text = Radio button 1.
 			text = Radio button 1.
 			group = testRadio
 			group = testRadio
-            autoWidth = AUTO_SIZE_FIT
-            autoHeight = AUTO_SIZE_FIT
 			selected = true
 			selected = true
 		}
 		}
 
 
@@ -95,22 +84,27 @@ form basicControls
 	
 	
 	image testImage
 	image testImage
 	{
 	{
-		position = 300, 250
-        autoWidth = AUTO_SIZE_FIT
-        autoHeight = AUTO_SIZE_FIT
+        alignment = ALIGN_BOTTOM_RIGHT
 		path = res/png/logo.png
 		path = res/png/logo.png
 	}
 	}
 
 
-	button alignedButton
+    container testPanel
     {
     {
-		margin
+        style = Panel
+
+        margin
 		{
 		{
-			right = 50
-			bottom = 100
+			right = 75
+			bottom = 170
 		}
 		}
 
 
         alignment = ALIGN_BOTTOM_RIGHT
         alignment = ALIGN_BOTTOM_RIGHT
-        size = 200, 100
-        text = Alignment: bottom-right. Right margin: 50. Bottom margin: 100.
+
+	    label
+        {
+            size = 200, 100
+            text = Style: Panel         Alignment: bottom-right   Right margin: 50           Bottom margin: 100
+            textAlignment = ALIGN_VCENTER_HCENTER
+        }
     }
     }
 }
 }

+ 1 - 1
samples/browser/res/common/forms/formFlowLayout.form

@@ -7,7 +7,7 @@ form flowLayout
 
 
     label label1
     label label1
     {
     {
-        style = Button
+        style = Panel
         size = 200, 200
         size = 200, 200
         text = Flow Layout
         text = Flow Layout
     }
     }

+ 1 - 2
samples/browser/res/common/forms/formScrolling.form

@@ -4,11 +4,10 @@ form scrolling
     size = 600, 600
     size = 600, 600
     scroll = SCROLL_BOTH
     scroll = SCROLL_BOTH
     scrollBarsAutoHide = true
     scrollBarsAutoHide = true
-	consumeInputEvents = true
 
 
     label label1
     label label1
     {
     {
-        style = Button
+        style = Panel
         width = 4000
         width = 4000
         height = 200
         height = 200
         text = Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!
         text = Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!  Label!

+ 0 - 5
samples/browser/res/common/forms/formSelect.form

@@ -3,17 +3,12 @@ form formSelect
     layout = LAYOUT_VERTICAL
     layout = LAYOUT_VERTICAL
     alignment = ALIGN_TOP_LEFT
     alignment = ALIGN_TOP_LEFT
     width = 220
     width = 220
-    autoHeight = AUTO_SIZE_FIT
 	consumeInputEvents = false
 	consumeInputEvents = false
 
 
 	radioButton form0
 	radioButton form0
 	{
 	{
-		style = Button
 		text = Basic Controls
 		text = Basic Controls
 		group = formSelection
 		group = formSelection
-        autoWidth = AUTO_SIZE_STRETCH
-		height = 60
-		textAlignment = ALIGN_VCENTER_LEFT
 		selected = true
 		selected = true
 	}
 	}
 
 

+ 1 - 2
samples/browser/res/common/forms/formVerticalLayout.form

@@ -3,11 +3,10 @@ form verticalLayout
     layout = LAYOUT_VERTICAL
     layout = LAYOUT_VERTICAL
     size = 600, 600
     size = 600, 600
     scroll = SCROLL_BOTH
     scroll = SCROLL_BOTH
-	consumeInputEvents = true
 
 
     label label2
     label label2
     {
     {
-        style = Button
+        style = Panel
         size = 200, 200
         size = 200, 200
         text = Vertical Layout
         text = Vertical Layout
     }
     }

+ 2 - 5
samples/browser/res/common/forms/formZOrder.form

@@ -1,15 +1,12 @@
 form zOrder
 form zOrder
 {
 {
-    //theme = res/common/default.theme
-    //style = basicContainer
     size = 600, 600
     size = 600, 600
     scroll = SCROLL_BOTH
     scroll = SCROLL_BOTH
-	consumeInputEvents = true
     batchingEnabled = false
     batchingEnabled = false
-	
+
     label label1
     label label1
     {
     {
-        style = Button
+        style = Panel
         size = 400, 200
         size = 400, 200
         text = TOP
         text = TOP
         zIndex = 3
         zIndex = 3

+ 1 - 2
samples/browser/res/common/gamepad.form

@@ -1,8 +1,7 @@
 form VIRTUAL GAMEPAD
 form VIRTUAL GAMEPAD
 {
 {
     theme = res/common/gamepad.theme
     theme = res/common/gamepad.theme
-    autoWidth = true
-    autoHeight = true
+    size = 100%, 100%
     consumeInputEvents = false
     consumeInputEvents = false
 
 
     container left
     container left

+ 1 - 8
samples/browser/res/common/inputs.form

@@ -1,24 +1,18 @@
 form inputTestControls
 form inputTestControls
 {
 {
-    theme = res/common/default.theme
     width = 200
     width = 200
     height = 350
     height = 350
     alignment = ALIGN_TOP_RIGHT
     alignment = ALIGN_TOP_RIGHT
-    consumeInputEvents = false
 
 
-    // Show/hide keyboard
     button showKeyboardButton
     button showKeyboardButton
     {
     {
-        style = buttonStyle
         position = 10, 60
         position = 10, 60
         size = 160, 100
         size = 160, 100
         text = Show virtual keyboard
         text = Show virtual keyboard
     }
     }
 
 
-    // Capture mouse
     button captureMouseButton
     button captureMouseButton
     {
     {
-        style = buttonStyle
         position = 10, 180
         position = 10, 180
         size = 160, 100
         size = 160, 100
         text = Capture mouse
         text = Capture mouse
@@ -26,9 +20,8 @@ form inputTestControls
     
     
     label restoreMouseLabel
     label restoreMouseLabel
     {
     {
-        style = underlined
         position = 10, 250
         position = 10, 250
         size = 160, 60
         size = 160, 60
         text = Press space to restore mouse
         text = Press space to restore mouse
     }
     }
-}
+}

+ 17 - 40
samples/browser/res/common/light.form

@@ -1,59 +1,43 @@
 form formLightSelect
 form formLightSelect
 {
 {
-    theme = res/common/default.theme
-    layout = LAYOUT_ABSOLUTE
-    style = noBorder
+    layout = LAYOUT_VERTICAL
     alignment = ALIGN_TOP_LEFT
     alignment = ALIGN_TOP_LEFT
-    autoWidth = AUTO_SIZE_FIT
-    autoHeight = AUTO_SIZE_FIT
+    style = Empty
 
 
 	container lightingType
 	container lightingType
     {
     {
-		style = basic
         layout = LAYOUT_VERTICAL
         layout = LAYOUT_VERTICAL
         position = 0, 20
         position = 0, 20
-        size = 230, 210
+        width = 230
+        style = Form
 		
 		
         label
         label
         {
         {
-            style = iconNoBorder
-            size = 210, 20
             textAlignment = ALIGN_TOP_HCENTER
             textAlignment = ALIGN_TOP_HCENTER
             text = Type
             text = Type
+            fontSize = 18
         }
         }
         
         
 		radioButton noLighting
 		radioButton noLighting
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = No Light
 			text = No Light
 			value = true
 			value = true
 		}
 		}
 
 
 	    radioButton directional
 	    radioButton directional
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = Directional Light
 			text = Directional Light
 			value = false
 			value = false
 		}
 		}
 
 
 		radioButton spot
 		radioButton spot
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = Spot Light
 			text = Spot Light
 			value = false
 			value = false
 		}
 		}
 
 
 		radioButton point
 		radioButton point
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = Point Light
 			text = Point Light
 			value = false
 			value = false
 		}
 		}
@@ -61,23 +45,21 @@ form formLightSelect
 
 
 	container lightProperties
 	container lightProperties
     {
     {
-		style = basic
         layout = LAYOUT_VERTICAL
         layout = LAYOUT_VERTICAL
-        position = 0, 230
-        size = 230, 380
+        width = 230
+        style = Form
     
     
         label
         label
         {
         {
-            style = iconNoBorder
-            size = 210, 20
             textAlignment = ALIGN_TOP_HCENTER
             textAlignment = ALIGN_TOP_HCENTER
             text = Properties
             text = Properties
+            fontSize = 18
         }
         }
         
         
 		slider redSlider
 		slider redSlider
 		{
 		{
-			style = iconNoBorder
-			size = 210, 60
+            height = 55
+            width = 100%
 			orientation = HORIZONTAL
 			orientation = HORIZONTAL
             textAlignment = ALIGN_LEFT
             textAlignment = ALIGN_LEFT
 			min = 0
 			min = 0
@@ -88,8 +70,8 @@ form formLightSelect
 	
 	
 		slider greenSlider
 		slider greenSlider
 		{
 		{
-			style = iconNoBorder
-			size = 210, 60
+			height = 55
+            width = 100%
 			orientation = HORIZONTAL
 			orientation = HORIZONTAL
             textAlignment = ALIGN_LEFT
             textAlignment = ALIGN_LEFT
 			min = 0
 			min = 0
@@ -100,8 +82,8 @@ form formLightSelect
 
 
 		slider blueSlider
 		slider blueSlider
 		{
 		{
-			style = iconNoBorder
-			size = 210, 60
+			height = 55
+            width = 100%
 			orientation = HORIZONTAL
 			orientation = HORIZONTAL
             textAlignment = ALIGN_LEFT
             textAlignment = ALIGN_LEFT
 			min = 0
 			min = 0
@@ -112,8 +94,8 @@ form formLightSelect
 
 
 		slider specularSlider
 		slider specularSlider
 		{
 		{
-			style = iconNoBorder
-			size = 210, 60
+			height = 55
+            width = 100%
 			orientation = HORIZONTAL
 			orientation = HORIZONTAL
             textAlignment = ALIGN_LEFT
             textAlignment = ALIGN_LEFT
 			min = 1
 			min = 1
@@ -121,20 +103,15 @@ form formLightSelect
 			value = 64
 			value = 64
 			text = Specular
 			text = Specular
 		}
 		}
+
 		checkbox specularCheckBox
 		checkbox specularCheckBox
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = Enable Specular
 			text = Enable Specular
 			value = false
 			value = false
 		}
 		}
 
 
 		checkbox bumpedCheckBox
 		checkbox bumpedCheckBox
 		{
 		{
-			style = iconNoBorder
-			imageSize = 35, 35
-			size = 200, 40
 			text = Enable BumpMapping
 			text = Enable BumpMapping
 			value = false
 			value = false
 		}
 		}

+ 1 - 6
samples/browser/res/common/physics.form

@@ -1,17 +1,12 @@
 form physicsScene
 form physicsScene
 {
 {
-    theme = res/common/default.theme
     layout = LAYOUT_VERTICAL
     layout = LAYOUT_VERTICAL
-    style = noBorder
     width = 200
     width = 200
-    height = 200
     alignment = ALIGN_BOTTOM_LEFT
     alignment = ALIGN_BOTTOM_LEFT
 
 
     button shapeButton
     button shapeButton
     {
     {
-        style = buttonStyle
-        autoWidth = true
-        height = 40
+        width = 100%
         text = Sphere
         text = Sphere
     }
     }
     
     

+ 13 - 24
samples/browser/res/common/terrain/terrain.form

@@ -1,10 +1,7 @@
 form terrainForm
 form terrainForm
 {
 {
-    theme = res/common/default.theme
-
-    style = Container
-    autoWidth = true
-    autoHeight = true
+    style = Empty
+    size = 100%, 100%
     consumeInputEvents = false
     consumeInputEvents = false
 
 
     padding
     padding
@@ -19,7 +16,7 @@ form terrainForm
     {
     {
         style = Form
         style = Form
         width = 230
         width = 230
-        height = 395
+        height = 310
         consumeInputEvents = false
         consumeInputEvents = false
 
 
         padding
         padding
@@ -28,31 +25,26 @@ form terrainForm
             left = -5
             left = -5
         }
         }
 
 
-        button plusButton
+        label plusButton
         {
         {
-            style = plus
-            width = 40
-            height = 40
+            x = 12
             visible = false
             visible = false
+            text = +
+            fontSize = 44
         }
         }
 
 
-        button minusButton
+        label minusButton : plusButton
         {
         {
-            style = minus
-            width = 40
-            height = 40
+            visible = true
+            text = -
         }
         }
 
 
         container settings
         container settings
         {
         {
-            autoWidth = true
-            autoHeight = true
             consumeInputEvents = false
             consumeInputEvents = false
 
 
             checkbox wireframe
             checkbox wireframe
 		    {
 		    {
-			    imageSize = 35, 35
-			    size = 200, 40
                 position = 10, 50
                 position = 10, 50
 			    text = Wireframe (1)
 			    text = Wireframe (1)
                 textAlignment = ALIGN_VCENTER_LEFT
                 textAlignment = ALIGN_VCENTER_LEFT
@@ -100,9 +92,8 @@ form terrainForm
     container physicsSettings
     container physicsSettings
     {
     {
         style = Form
         style = Form
-        position = 0, 395
+        position = 0, 310
         width = 230
         width = 230
-        height = 165
         layout = LAYOUT_VERTICAL
         layout = LAYOUT_VERTICAL
         consumeInputEvents = false
         consumeInputEvents = false
 
 
@@ -116,9 +107,8 @@ form terrainForm
 
 
         button dropSphere
         button dropSphere
         {
         {
-            autoWidth = true
+            width = 100%
             text = Drop Sphere
             text = Drop Sphere
-            height = 45
         }
         }
 
 
         button dropBox : dropSphere
         button dropBox : dropSphere
@@ -144,8 +134,7 @@ form terrainForm
         label message
         label message
         {
         {
             consumeInputEvents = false
             consumeInputEvents = false
-            autoWidth = true
-            autoHeight = true
+            size = 100%, 100%
             font = res/ui/arial.gpb
             font = res/ui/arial.gpb
             fontSize = 24
             fontSize = 24
             textAlignment = ALIGN_VCENTER_HCENTER
             textAlignment = ALIGN_VCENTER_HCENTER

+ 25 - 35
samples/browser/res/common/text.form

@@ -1,29 +1,18 @@
 form textTest
 form textTest
 {
 {
-    theme = res/common/default.theme
-    style = basic
-    autoHeight = true
+    height = 100%
     width = 240
     width = 240
     layout = LAYOUT_VERTICAL
     layout = LAYOUT_VERTICAL
-    scroll = SCROLL_VERTICAL
-	consumeInputEvents = true
 
 
     label topLabel
     label topLabel
     {
     {
-        style = title
-        autoWidth = true
-        height = 40
-        textAlignment = ALIGN_BOTTOM_LEFT
-        consumeInputEvents = false
         text = Text
         text = Text
+        fontSize = 22
     }
     }
 
 
-    // Change font
-    // Wouldn't this be a great place to use a drop-down? ;)
     button fontButton
     button fontButton
     {
     {
-        style = buttonStyle
-        autoWidth = true
+        width = 100%
         height = 50
         height = 50
         text = Font (arial)
         text = Font (arial)
     }
     }
@@ -53,6 +42,11 @@ form textTest
         text = Font API (Advanced)
         text = Font API (Advanced)
     }
     }
 
 
+    label
+    {
+        size = 10,10
+    }
+
     label sizeLabel : topLabel
     label sizeLabel : topLabel
     {
     {
         text = Size (18)
         text = Size (18)
@@ -60,14 +54,10 @@ form textTest
 
 
     container size
     container size
     {
     {
-        style = noBorder
-        autoWidth = true
-        height = 60
-        consumeInputEvents = false
+        width = 100%
 
 
         button smallerButton
         button smallerButton
         {
         {
-            style = buttonStyle
             width = 50
             width = 50
             height = 50
             height = 50
             text = -
             text = -
@@ -80,66 +70,66 @@ form textTest
         }
         }
     }
     }
 
 
+    label
+    {
+        size = 10,10
+    }
+
     label alignmentLabel : topLabel
     label alignmentLabel : topLabel
     {
     {
-        height = 60
         text = Align (Top-left)
         text = Align (Top-left)
     }
     }
 
 
-    // Grid layout would be best, but flow should work.
     container alignments
     container alignments
     {
     {
-        style = noBorder
-        autoWidth = true
-        height = 200
+        width = 100%
         layout = LAYOUT_FLOW
         layout = LAYOUT_FLOW
-        consumeInputEvents = false
 
 
         button topLeftButton
         button topLeftButton
         {
         {
-            style = buttonStyle
             size = 60, 60
             size = 60, 60
-            text = 7
+            text =
+            fontSize = 20
         }
         }
 
 
         button topCenterButton : topLeftButton
         button topCenterButton : topLeftButton
         {
         {
-            text = 8
+            text = ^
         }
         }
 
 
         button topRightButton : topLeftButton
         button topRightButton : topLeftButton
         {
         {
-            text = 9
+            text =
         }
         }
 
 
         button centerLeftButton : topLeftButton
         button centerLeftButton : topLeftButton
         {
         {
-            text = 4
+            text = <
         }
         }
 
 
         button centerButton : topLeftButton
         button centerButton : topLeftButton
         {
         {
-            text = 5
+            text = .
         }
         }
 
 
         button centerRightButton : topLeftButton
         button centerRightButton : topLeftButton
         {
         {
-            text = 6
+            text = >
         }
         }
 
 
         button bottomLeftButton : topLeftButton
         button bottomLeftButton : topLeftButton
         {
         {
-            text = 1
+            text =
         }
         }
 
 
         button bottomCenterButton : topLeftButton
         button bottomCenterButton : topLeftButton
         {
         {
-            text = 2
+            text = v
         }
         }
 
 
         button bottomRightButton : topLeftButton
         button bottomRightButton : topLeftButton
         {
         {
-            text = 3
+            text =
         }
         }
     }
     }
 }
 }

BIN
samples/browser/res/png/default-theme.png


+ 2 - 2
samples/browser/src/Audio3DSample.cpp

@@ -151,7 +151,7 @@ void Audio3DSample::render(float elapsedTime)
     // Visit all the nodes in the scene for drawing
     // Visit all the nodes in the scene for drawing
     _scene->visit(this, &Audio3DSample::drawScene);
     _scene->visit(this, &Audio3DSample::drawScene);
 
 
-    drawDebugText(0, _font->getSize());
+    drawDebugText(5, _font->getSize());
 
 
     _gamepad->draw();
     _gamepad->draw();
     drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
     drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
@@ -327,7 +327,7 @@ void Audio3DSample::drawVector3(const char* str, const Vector3& vector, int x, i
 {
 {
     char buffer[255];
     char buffer[255];
     sprintf(buffer, "%s: (%f, %f, %f)", str, vector.x, vector.y, vector.z);
     sprintf(buffer, "%s: (%f, %f, %f)", str, vector.x, vector.y, vector.z);
-    _font->drawText(buffer, x, y, Vector4::one(), _font->getSize());
+    _font->drawText(buffer, x, y, Vector4::one(), 22);
 }
 }
 
 
 void Audio3DSample::loadGrid(Scene* scene)
 void Audio3DSample::loadGrid(Scene* scene)

+ 1 - 1
samples/browser/src/GamepadSample.cpp

@@ -73,7 +73,7 @@ void GamepadSample::render(float elapsedTime)
     drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
     drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
 
 
     _font->start();
     _font->start();
-    _font->drawText(_status.c_str(), 5, 25, Vector4::one());
+    _font->drawText(_status.c_str(), 7, 27, Vector4::one(), 22);
     _font->finish();
     _font->finish();
 
 
 
 

+ 1 - 1
samples/browser/src/LightSample.cpp

@@ -181,7 +181,7 @@ void LightSample::render(float elapsedTime)
 
 
     _form->draw();
     _form->draw();
 
 
-    drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
+    drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 235, 2, getFrameRate());
 }
 }
 
 
 void LightSample::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 void LightSample::touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)

+ 3 - 5
samples/browser/src/SamplesGame.cpp

@@ -28,15 +28,13 @@ void SamplesGame::initialize()
 
 
     // Create the selection form
     // Create the selection form
     _sampleSelectForm = Form::create("sampleSelect", NULL, Layout::LAYOUT_VERTICAL);
     _sampleSelectForm = Form::create("sampleSelect", NULL, Layout::LAYOUT_VERTICAL);
-    _sampleSelectForm->setWidth(200);
-    _sampleSelectForm->setAutoHeight(Control::AUTO_SIZE_STRETCH);
+    _sampleSelectForm->setWidth(220);
+    _sampleSelectForm->setHeight(1, true);
     _sampleSelectForm->setScroll(Container::SCROLL_VERTICAL);
     _sampleSelectForm->setScroll(Container::SCROLL_VERTICAL);
     const size_t size = _samples->size();
     const size_t size = _samples->size();
     for (size_t i = 0; i < size; ++i)
     for (size_t i = 0; i < size; ++i)
     {
     {
 		Label* categoryLabel = Label::create((*_categories)[i].c_str());
 		Label* categoryLabel = Label::create((*_categories)[i].c_str());
-        categoryLabel->setAutoWidth(Control::AUTO_SIZE_FIT);
-        categoryLabel->setAutoHeight(Control::AUTO_SIZE_FIT);
         categoryLabel->setFontSize(22);
         categoryLabel->setFontSize(22);
         categoryLabel->setText((*_categories)[i].c_str());
         categoryLabel->setText((*_categories)[i].c_str());
         _sampleSelectForm->addControl(categoryLabel);
         _sampleSelectForm->addControl(categoryLabel);
@@ -49,7 +47,7 @@ void SamplesGame::initialize()
             SampleRecord sampleRecord = list[j];
             SampleRecord sampleRecord = list[j];
 			Button* sampleButton = Button::create(sampleRecord.title.c_str());
 			Button* sampleButton = Button::create(sampleRecord.title.c_str());
             sampleButton->setText(sampleRecord.title.c_str());
             sampleButton->setText(sampleRecord.title.c_str());
-            sampleButton->setAutoWidth(Control::AUTO_SIZE_STRETCH);
+            sampleButton->setWidth(1, true);
             sampleButton->setHeight(50);
             sampleButton->setHeight(50);
             sampleButton->addListener(this, Control::Listener::CLICK);
             sampleButton->addListener(this, Control::Listener::CLICK);
             _sampleSelectForm->addControl(sampleButton);
             _sampleSelectForm->addControl(sampleButton);

+ 2 - 3
samples/character/res/common/gamepad.form

@@ -1,8 +1,7 @@
 form gamepadForm
 form gamepadForm
 {
 {
     theme = res/common/gamepad.theme
     theme = res/common/gamepad.theme
-    autoWidth = true
-    autoHeight = true
+    size = 100%, 100%
 
 
     container left
     container left
     {
     {
@@ -12,7 +11,7 @@ form gamepadForm
         
         
         joystick
         joystick
         {
         {
-        index = 0
+            index = 0
             style = joystickStyle
             style = joystickStyle
             size = 256, 256
             size = 256, 256
             alignment = ALIGN_VCENTER_HCENTER
             alignment = ALIGN_VCENTER_HCENTER

+ 6 - 1
samples/particles/game.config

@@ -5,4 +5,9 @@ window
     height = 800
     height = 800
     fullscreen = false
     fullscreen = false
     resizable = true
     resizable = true
-}
+}
+
+ui
+{
+    theme = res/ui/default.theme
+}

+ 61 - 89
samples/particles/res/editor.form

@@ -1,46 +1,38 @@
 form particleEditor
 form particleEditor
 {
 {
-    theme = res/editor.theme
-    autoWidth = true
-    autoHeight = true
+    ${leftWidth} = 195
+
+    size = 100%, 100%
     consumeInputEvents = false
     consumeInputEvents = false
+    style = Empty
 
 
-	// Vsync checkbox
 	checkBox vsync
 	checkBox vsync
 	{
 	{
-		style = iconNoBorder
-		size = 100, 35
-		position = 165, 5
-		imageSize = 30, 30
+		position = 200, 5
 		text = VSYNC
 		text = VSYNC
 		checked = true
 		checked = true
+        fontSize = 18
 	}
 	}
- 
+
     container leftSide
     container leftSide
     {
     {
-        style = noBorder
         layout = LAYOUT_VERTICAL
         layout = LAYOUT_VERTICAL
-        width = 160
-        autoHeight = true
+        width = ${leftWidth}
 
 
         container saveLoad
         container saveLoad
         {
         {
-            style = basic
-            size = 160, 100
+            style = Form
+            width = 100%
             layout = LAYOUT_VERTICAL
             layout = LAYOUT_VERTICAL
 
 
 	        button save
 	        button save
 	        {
 	        {
-		        style = buttonStyle
-                width = 140
-		        height = 40
-                x = 100
+                width = 100%
 		        text = Save
 		        text = Save
 	        }
 	        }
 
 
             button load : save
             button load : save
 	        {
 	        {
-                x = 200
 		        text = Load
 		        text = Load
 	        }
 	        }
         }
         }
@@ -48,37 +40,37 @@ form particleEditor
         // Image settings
         // Image settings
         container image
         container image
         {
         {
-	        style = basic
-	        size = 160, 200
-	        layout = LAYOUT_VERTICAL
+            style = Form
+            width = 100%
+
+	        layout
+            {
+                type = LAYOUT_VERTICAL
+                spacing = 5
+            }
 
 
             label
             label
             {
             {
-                style = title
-                size = 150, 30
                 text = Image
                 text = Image
+                fontSize = 18
             }
             }
 
 
 	        image sprite
 	        image sprite
 	        {
 	        {
-		        style = image
 		        path = res/fire.png
 		        path = res/fire.png
-		        size = 140, 140
+		        size = 120, 120
 	        }
 	        }
 
 
             container imageSettings
             container imageSettings
             {
             {
-                style = noBorder
-                size = 160, 230
+                width = 100%
 		        layout = LAYOUT_VERTICAL
 		        layout = LAYOUT_VERTICAL
 
 
                 radioButton additive
                 radioButton additive
                 {
                 {
-                    style = radio
                     text = Additive
                     text = Additive
                     group = blendMode
                     group = blendMode
-                    size = 140, 25
-                    imageSize = 25, 25
+                    height = 25
                     selected = true
                     selected = true
                 }
                 }
 
 
@@ -102,75 +94,61 @@ form particleEditor
 
 
                 container
                 container
                 {
                 {
-                    style = noBorder
-                    autoWidth = true
-                    height = 30
+                    width = 100%
 
 
                     label
                     label
                     {
                     {
-                        style = noBorder
                         text = Frame Count:
                         text = Frame Count:
-                        size = 100, 26
+                        alignment = ALIGN_VCENTER_LEFT
                     }
                     }
 
 
                     textBox frameCount
                     textBox frameCount
                     {
                     {
-                        style = textBox
                         text = 1
                         text = 1
-                        size = 45, 22
-                        position = 100, 0
+                        size = 60, 32
+                        position = 110, 0
                     }
                     }
                 }
                 }
 
 
                 container
                 container
                 {
                 {
-                    style = noBorder
-                    autoWidth = true
-                    height = 30
+                    width = 100%
 
 
                     label
                     label
                     {
                     {
-                        style = noBorder
                         text = Frame Width:
                         text = Frame Width:
-                        size = 100, 26
+                        alignment = ALIGN_VCENTER_LEFT
                     }
                     }
 
 
                     textBox frameWidth
                     textBox frameWidth
                     {
                     {
-                        style = textBox
                         text = 1
                         text = 1
-                        size = 45, 22
-                        position = 100, 0
+                        size = 60, 32
+                        position = 110, 0
                     }
                     }
                 }
                 }
 
 
                 container
                 container
                 {
                 {
-                    style = noBorder
-                    autoWidth = true
-                    height = 30
+                    width = 100%
 
 
                     label
                     label
                     {
                     {
-                        style = noBorder
                         text = Frame Height:
                         text = Frame Height:
-                        size = 100, 26
+                        alignment = ALIGN_VCENTER_LEFT
                     }
                     }
 
 
                     textBox frameHeight
                     textBox frameHeight
                     {
                     {
-                        style = textBox
                         text = 1
                         text = 1
-                        size = 45, 22
-                        position = 100, 0
+                        size = 60, 32
+                        position = 110, 0
                     }
                     }
                 }
                 }
 
 
                 button updateFrames
                 button updateFrames
                 {
                 {
-			        style = buttonStyle
-			        width = 140
-			        height = 40
+			        width = 100%
 			        text = Update
 			        text = Update
                 }
                 }
             }
             }
@@ -179,24 +157,26 @@ form particleEditor
         // Emission settings
         // Emission settings
         container emission
         container emission
         {
         {
-	        style = basic
+            style = Form
 	        layout = LAYOUT_VERTICAL
 	        layout = LAYOUT_VERTICAL
-	        size = 160, 200
+	        width = ${leftWidth}
 
 
 	        // Burst emission
 	        // Burst emission
 	        button emit
 	        button emit
 	        {
 	        {
-		        style = buttonStyle
-		        position = 0, 50
-		        size = 140, 40
+                width = 100%
 		        text = Emit
 		        text = Emit
 	        }
 	        }
 
 
+            label spacer
+            {
+                size = 5,5
+            }
+
 	        // Emission rate
 	        // Emission rate
 	        slider emissionRate
 	        slider emissionRate
 	        {
 	        {
-		        style = noBorder
-		        size = 140, 50
+                width = 100%
 		        orientation = HORIZONTAL
 		        orientation = HORIZONTAL
 		        min = 1
 		        min = 1
 		        max = 500
 		        max = 500
@@ -220,9 +200,6 @@ form particleEditor
 	        // Start / Stop Emitter
 	        // Start / Stop Emitter
 	        checkBox started
 	        checkBox started
 	        {
 	        {
-		        style = iconNoBorder
-		        size = 140, 40
-		        imageSize = 35, 35
 		        text = Running
 		        text = Running
 		        checked = true
 		        checked = true
 	        }
 	        }
@@ -230,19 +207,16 @@ form particleEditor
 
 
         button reset
         button reset
 	    {
 	    {
-		    style = buttonStyle
-            width = 160
-		    height = 40
+            width = ${leftWidth}
 		    text = Reset
 		    text = Reset
 	    }
 	    }
     }
     }
 
 
     container particleProperties
     container particleProperties
     {
     {
-        style = particleProps
+        style = Form
         alignment = ALIGN_TOP_RIGHT
         alignment = ALIGN_TOP_RIGHT
-        width = 210
-        autoHeight = true
+        size = 210, 100%
         layout = LAYOUT_VERTICAL
         layout = LAYOUT_VERTICAL
         scroll = SCROLL_VERTICAL
         scroll = SCROLL_VERTICAL
         scrollBarsAutoHide = false
         scrollBarsAutoHide = false
@@ -250,15 +224,17 @@ form particleEditor
         // Particle Size
         // Particle Size
         label titleSize
         label titleSize
         {
         {
-            style = title
-            size = 150, 30
+            padding
+            {
+                bottom = 5
+            }
             text = Particle Size
             text = Particle Size
+            fontSize = 18
         }
         }
 
 
         slider startMin
         slider startMin
         {
         {
-            style = noBorder
-            size = 150, 50
+            width = 100%
             orientation = HORIZONTAL
             orientation = HORIZONTAL
             min = 0
             min = 0
             max = 10
             max = 10
@@ -294,8 +270,7 @@ form particleEditor
 
 
         slider energyMin
         slider energyMin
         {
         {
-            style = noBorder
-            size = 150, 50
+            width = 100%
             orientation = HORIZONTAL
             orientation = HORIZONTAL
             min = 0
             min = 0
             max = 5000
             max = 5000
@@ -320,8 +295,7 @@ form particleEditor
 
 
         slider startRed
         slider startRed
         {
         {
-            style = noBorder
-            size = 150, 50
+            width = 100%
             orientation = HORIZONTAL
             orientation = HORIZONTAL
             min = 0
             min = 0
             max = 1
             max = 1
@@ -577,21 +551,19 @@ form particleEditor
 	// Camera Zoom
 	// Camera Zoom
 	container zoom
 	container zoom
 	{
 	{
-		style = noBorder
-		size = 160, 50
         alignment = ALIGN_BOTTOM_HCENTER
         alignment = ALIGN_BOTTOM_HCENTER
 
 
 		button zoomIn
 		button zoomIn
 		{
 		{
-			style = buttonStyle
-			size = 80, 50
-			text = Zoom  In
+			width = 60
+			text = +
+            fontSize = 30
 		}
 		}
 
 
 		button zoomOut : zoomIn
 		button zoomOut : zoomIn
 		{
 		{
-			position = 80, 0
-			text = Zoom Out
+            x = 60
+			text = -
 		}
 		}
 	}
 	}
 }
 }

+ 7 - 6
samples/particles/src/ParticlesGame.cpp

@@ -18,7 +18,7 @@ ParticlesGame::ParticlesGame() : _scene(NULL), _panning(false), _rotating(false)
 void ParticlesGame::addGrid(unsigned int lineCount)
 void ParticlesGame::addGrid(unsigned int lineCount)
 {
 {
     float z = -1;
     float z = -1;
-
+    
     // There needs to be an odd number of lines
     // There needs to be an odd number of lines
     lineCount |= 1;
     lineCount |= 1;
     const unsigned int pointCount = lineCount * 4;
     const unsigned int pointCount = lineCount * 4;
@@ -824,7 +824,7 @@ void ParticlesGame::render(float elapsedTime)
     _form->draw();
     _form->draw();
 
 
     // Draw the framerate and number of live particles.
     // Draw the framerate and number of live particles.
-    drawFrameRate(_font, Vector4(1, 1, 1, 1), 170, 40, getFrameRate());
+    drawFrameRate(_font, Vector4(1, 1, 1, 1), 205, 40, getFrameRate());
 }
 }
 
 
 bool ParticlesGame::drawScene(Node* node, void* cookie)
 bool ParticlesGame::drawScene(Node* node, void* cookie)
@@ -1158,19 +1158,20 @@ void ParticlesGame::updateTexture()
 
 
 void ParticlesGame::updateImageControl()
 void ParticlesGame::updateImageControl()
 {
 {
-    ((ImageControl*)_form->getControl("sprite"))->setImage(_particleEmitter->getTexture()->getPath());
+    ImageControl* img = (ImageControl*)_form->getControl("sprite");
+    img->setImage(_particleEmitter->getTexture()->getPath());
 
 
     // Resize the image control so keep it to scale
     // Resize the image control so keep it to scale
     int w = _particleEmitter->getTexture()->getWidth();
     int w = _particleEmitter->getTexture()->getWidth();
     int h = _particleEmitter->getTexture()->getHeight();
     int h = _particleEmitter->getTexture()->getHeight();
     int max = w > h ? w : h;
     int max = w > h ? w : h;
-    if (max > 140)
+    if (max > 120)
     {
     {
-        float ratio = 140.0f / max;
+        float ratio = 120.0f / max;
         w *= ratio;
         w *= ratio;
         h *= ratio;
         h *= ratio;
     }
     }
-    ((ImageControl*)_form->getControl("sprite"))->setSize(w, h);
+    img->setSize(w, h);
     _form->getControl("image")->setHeight(h + _form->getControl("imageSettings")->getHeight() + 50);
     _form->getControl("image")->setHeight(h + _form->getControl("imageSettings")->getHeight() + 50);
 
 
     ((TextBox*)_form->getControl("frameCount"))->setText(toString(_particleEmitter->getSpriteFrameCount()).c_str());
     ((TextBox*)_form->getControl("frameCount"))->setText(toString(_particleEmitter->getSpriteFrameCount()).c_str());

+ 5 - 0
samples/racer/game.atc.config

@@ -57,3 +57,8 @@ gamepad
 {
 {
     form = res/common/gamepad.form
     form = res/common/gamepad.form
 }
 }
+
+ui
+{
+    theme = res/ui/default.theme
+}

+ 5 - 0
samples/racer/game.dxt.config

@@ -65,3 +65,8 @@ gamepad
 {
 {
     form = res/common/gamepad.form
     form = res/common/gamepad.form
 }
 }
+
+ui
+{
+    theme = res/ui/default.theme
+}

+ 5 - 0
samples/racer/game.png.config

@@ -65,3 +65,8 @@ gamepad
 {
 {
     form = res/common/gamepad.form
     form = res/common/gamepad.form
 }
 }
+
+ui
+{
+    theme = res/ui/default.theme
+}

+ 5 - 0
samples/racer/game.pvr.config

@@ -57,3 +57,8 @@ gamepad
 {
 {
     form = res/common/gamepad.form
     form = res/common/gamepad.form
 }
 }
+
+ui
+{
+    theme = res/ui/default.theme
+}

+ 4 - 4
samples/racer/res/common/gamepad.form

@@ -1,15 +1,15 @@
-form VIRTUAL GAMEPAD
+form gamepad
 {
 {
     theme = res/common/gamepad.theme
     theme = res/common/gamepad.theme
-    autoWidth = true
-    autoHeight = true
+
+    size = 100%, 100%
 
 
     container left
     container left
     {
     {
         alignment = ALIGN_BOTTOM_LEFT
         alignment = ALIGN_BOTTOM_LEFT
         size = 300, 300
         size = 300, 300
         consumeEvents = false
         consumeEvents = false
-        
+
         joystick
         joystick
         {
         {
             index = 0
             index = 0

+ 9 - 22
samples/racer/res/common/menu.form

@@ -1,59 +1,46 @@
-form menu
+form pauseMenu
 {
 {
-    theme = res/common/menu.theme
-    width = 320
-    height = 180
     alignment = ALIGN_VCENTER_HCENTER
     alignment = ALIGN_VCENTER_HCENTER
-    style = basic
 
 
-    // Controls
     container controlsContainer
     container controlsContainer
     {
     {
-        style = noBorder
-        autoWidth = true
-        height = 60
+        width = 100%
 
 
         label controlsLabel
         label controlsLabel
         {
         {
-            style = title
-            autoWidth = true
+            size = 100%, 30
 			textAlignment =  ALIGN_LEFT
 			textAlignment =  ALIGN_LEFT
-            height = 30
             text = Controls
             text = Controls
+            fontSize = 22
         }
         }
 
 
         radioButton useGamepad
         radioButton useGamepad
         {
         {
-            style = iconNoBorder
             group = controls
             group = controls
-            position = 0, 25
-            size = 150, 40
-            imageSize = 35, 35
+            position = 0, 35
+            width = 150
             selected = true
             selected = true
             text = Gamepad
             text = Gamepad
         }
         }
 
 
         radioButton useTilt : useGamepad
         radioButton useTilt : useGamepad
         {
         {
-            position = 150, 25
+            position = 150, 35
             text = Tilt
             text = Tilt
             selected = false
             selected = false
         }
         }
     }
     }
 
 
-    // Reset
     button newGameButton
     button newGameButton
     {
     {
-        style = buttonStyle
-        position = 0, 100
+        position = 0, 90
         size = 150, 50
         size = 150, 50
         text = New Game
         text = New Game
     }
     }
 
 
-    // Exit
     button quitGameButton : newGameButton
     button quitGameButton : newGameButton
     {
     {
-        position = 150, 100
+        position = 150, 90
         text = Quit Game
         text = Quit Game
     }
     }
 }
 }

+ 3 - 6
samples/racer/res/common/overlay.form

@@ -1,16 +1,13 @@
 form menu
 form menu
 {
 {
-    theme = res/common/menu.theme
-    width = 110
-    height = 70
+    width = 120
     alignment = ALIGN_TOP_RIGHT
     alignment = ALIGN_TOP_RIGHT
+    style = Empty
 
 
-    // Pause and show menu
     button menuButton
     button menuButton
     {
     {
-        style = buttonStyle
         position = 10, 10
         position = 10, 10
-        size = 90, 50
+        width = 100
         text = Menu
         text = Menu
     }
     }
 }
 }