Bladeren bron

Merge pull request #330 from kcunney/next

Adds XBOX 360 Controller support for PlatformWin32
Sean Paul Taylor 13 jaren geleden
bovenliggende
commit
ad28edd9a5
43 gewijzigde bestanden met toevoegingen van 2618 en 76 verwijderingen
  1. 2 2
      gameplay/src/Container.cpp
  2. 18 0
      gameplay/src/Control.cpp
  3. 12 0
      gameplay/src/Control.h
  4. 24 7
      gameplay/src/Game.cpp
  5. 25 3
      gameplay/src/Game.h
  6. 15 2
      gameplay/src/Game.inl
  7. 111 31
      gameplay/src/Gamepad.cpp
  8. 47 16
      gameplay/src/Gamepad.h
  9. 104 1
      gameplay/src/Platform.h
  10. 60 0
      gameplay/src/PlatformAndroid.cpp
  11. 60 0
      gameplay/src/PlatformLinux.cpp
  12. 60 0
      gameplay/src/PlatformMacOSX.mm
  13. 60 0
      gameplay/src/PlatformQNX.cpp
  14. 369 0
      gameplay/src/PlatformWin32.cpp
  15. 60 0
      gameplay/src/PlatformiOS.mm
  16. 17 0
      gameplay/src/RadioButton.cpp
  17. 18 0
      gameplay/src/RadioButton.h
  18. 78 0
      gameplay/src/lua/lua_Button.cpp
  19. 2 0
      gameplay/src/lua/lua_Button.h
  20. 78 0
      gameplay/src/lua/lua_CheckBox.cpp
  21. 2 0
      gameplay/src/lua/lua_CheckBox.h
  22. 78 0
      gameplay/src/lua/lua_Container.cpp
  23. 2 0
      gameplay/src/lua/lua_Container.h
  24. 78 0
      gameplay/src/lua/lua_Control.cpp
  25. 2 0
      gameplay/src/lua/lua_Control.h
  26. 78 0
      gameplay/src/lua/lua_Form.cpp
  27. 2 0
      gameplay/src/lua/lua_Form.h
  28. 38 0
      gameplay/src/lua/lua_Game.cpp
  29. 1 0
      gameplay/src/lua/lua_Game.h
  30. 90 14
      gameplay/src/lua/lua_Gamepad.cpp
  31. 2 0
      gameplay/src/lua/lua_Gamepad.h
  32. 78 0
      gameplay/src/lua/lua_Joystick.cpp
  33. 2 0
      gameplay/src/lua/lua_Joystick.h
  34. 78 0
      gameplay/src/lua/lua_Label.cpp
  35. 2 0
      gameplay/src/lua/lua_Label.h
  36. 494 0
      gameplay/src/lua/lua_Platform.cpp
  37. 12 0
      gameplay/src/lua/lua_Platform.h
  38. 194 0
      gameplay/src/lua/lua_RadioButton.cpp
  39. 5 0
      gameplay/src/lua/lua_RadioButton.h
  40. 78 0
      gameplay/src/lua/lua_Slider.cpp
  41. 2 0
      gameplay/src/lua/lua_Slider.h
  42. 78 0
      gameplay/src/lua/lua_TextBox.cpp
  43. 2 0
      gameplay/src/lua/lua_TextBox.h

+ 2 - 2
gameplay/src/Container.cpp

@@ -987,8 +987,8 @@ bool Container::pointerEvent(bool mouse, char evt, int x, int y, int data)
         }
 
         Control::State currentState = control->getState();
-        if ((control->isContainer() && currentState == Control::FOCUS) || 
-            (currentState != Control::NORMAL) ||// && control->_contactIndex == data) ||
+        if ((control->isContainer() && currentState == Control::FOCUS) ||
+            (currentState != Control::NORMAL) ||
             ((evt == Touch::TOUCH_PRESS ||
               evt == Mouse::MOUSE_PRESS_LEFT_BUTTON ||
               evt == Mouse::MOUSE_PRESS_MIDDLE_BUTTON ||

+ 18 - 0
gameplay/src/Control.cpp

@@ -153,6 +153,24 @@ void Control::setSize(float width, float height)
     }
 }
 
+void Control::setWidth(float width)
+{
+    if (width != _bounds.width)
+    {
+        _bounds.width = width;
+        _dirty = true;
+    }
+}
+
+void Control::setHeight(float height)
+{
+    if (height != _bounds.height)
+    {
+        _bounds.height = height;
+        _dirty = true;
+    }
+}
+
 void Control::setBounds(const Rectangle& bounds)
 {
     if (bounds != _bounds)

+ 12 - 0
gameplay/src/Control.h

@@ -212,6 +212,18 @@ public:
      */
     virtual void setSize(float width, float height);
 
+    /** 
+     * Set the desired width of the control, including it's border and padding, before clipping.
+     * @param width The width;
+     */
+    virtual void setWidth(float width);
+
+    /** 
+     * Set the desired height of the control, including it's border and padding, before clipping.
+     * @param height The height;
+     */
+    virtual void setHeight(float height);
+
     /**
      * Set the bounds of this control, relative to its parent container and including its
      * border and padding, before clipping.

+ 24 - 7
gameplay/src/Game.cpp

@@ -112,6 +112,9 @@ bool Game::startup()
     RenderState::initialize();
     FrameBuffer::initialize();
     
+    // Load any gamepads, ui or physical.
+    loadGamepads();
+
     _animationController = new AnimationController();
     _animationController->initialize();
 
@@ -124,8 +127,6 @@ bool Game::startup()
     _aiController = new AIController();
     _aiController->initialize();
 
-    loadGamepads();
-    
     _scriptController = new ScriptController();
     _scriptController->initialize();
 
@@ -265,6 +266,7 @@ void Game::frame()
         initialize();
         _scriptController->initializeGame();
         _initialized = true;
+        triggerGamepadEvents(); // Now that the game has been initialized, trigger any gamepad attached events.
     }
 
     if (_state == Game::RUNNING)
@@ -527,29 +529,44 @@ void Game::loadConfig()
 
 void Game::loadGamepads()
 {
+    // Load virtual gamepads.
     if (_properties)
     {
         // Check if there is a virtual keyboard included in the .config file.
         // If there is, try to create it and assign it to "player one".
         Properties* gamepadProperties = _properties->getNamespace("gamepads", true);
+        unsigned int gamepadCount = 0;
         if (gamepadProperties && gamepadProperties->exists("form"))
         {
             const char* gamepadFormPath = gamepadProperties->getString("form");
             GP_ASSERT(gamepadFormPath);
-            Gamepad* gamepad = createGamepad(gamepadProperties->getId(), gamepadFormPath);
+            Gamepad* gamepad = new Gamepad(gamepadCount, gamepadFormPath);
             GP_ASSERT(gamepad);
+
+            _gamepads->push_back(gamepad);
+            gamepadCount++;
         }
     }
+
+    // Checks for any physical gamepads
+    getGamepadCount();
 }
 
-Gamepad* Game::createGamepad(const char* gamepadId, const char* gamepadFormPath)
+unsigned int Game::createGamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount)
 {
-    GP_ASSERT(gamepadFormPath);
-    Gamepad* gamepad = new Gamepad(gamepadId, gamepadFormPath);
+    Gamepad* gamepad = new Gamepad(id, handle, buttonCount, joystickCount, triggerCount);
     GP_ASSERT(gamepad);
     _gamepads->push_back(gamepad);
+    return _gamepads->size() - 1;
+}
 
-    return gamepad;
+void Game::triggerGamepadEvents()
+{
+    for (std::vector<Gamepad*>::iterator itr = _gamepads->begin(); itr != _gamepads->end(); itr++)
+    {
+        if ((*itr)->isAttached())
+            gamepadEvent(Gamepad::ATTACHED_EVENT, (*itr));
+    }
 }
 
 }

+ 25 - 3
gameplay/src/Game.h

@@ -26,6 +26,9 @@ class ScriptController;
  */
 class Game
 {
+
+    friend class Platform;
+
 public:
     
     /**
@@ -349,19 +352,28 @@ public:
     inline bool isCursorVisible();
 
     /**
-     * Gamepad callback on gamepad events.
+     * Gamepad callback on gamepad events. Override to receive Gamepad::ATTACHED_EVENT 
+     * and Gamepad::DETACHED_EVENT.
      *
      * @param evt The gamepad event that occurred.
      * @param gamepad the gamepad the event occurred on
      */
     virtual void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
+    
+    /**
+     * Gets the number of gamepad's that can be used in the game. Includes gamepads not connected.
+     * 
+     * @return The number of gamepad's that can be used in the game.
+     */
+    inline unsigned int getGamepadCount() const;
 
     /**
      * Gets the number of gamepad's connected to the game.
+     * Can be called to detects if any gamepads have been attached or detached.
      * 
-     * @return The number of gamepad's connected to the game.
+     * @return The number of gamepads attached to the Platform.
      */
-    inline unsigned int getGamepadCount() const;
+    inline unsigned int getAttachedGamepads();
 
     /**
      * Gets the gamepad at the specified index.
@@ -554,6 +566,16 @@ private:
      */
     Gamepad* createGamepad(const char* gamepadId, const char* gamepadFormPath);
 
+    /**
+     * Creates a Gamepad object for a physical gamepad.
+     */
+    unsigned int createGamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount);
+
+    /**
+     * Triggers any Gamepad::ATTACHED_EVENTS after initialization.
+     */
+    void triggerGamepadEvents();
+
     bool _initialized;                          // If game has initialized yet.
     State _state;                               // The game state.
     static double _pausedTimeLast;              // The last time paused.

+ 15 - 2
gameplay/src/Game.inl

@@ -66,8 +66,6 @@ void Game::renderOnce(T* instance, void (T::*method)(void*), void* cookie)
     Platform::swapBuffers();
 }
 
-
-
 inline bool Game::hasMouse()
 {
     return Platform::hasMouse();
@@ -113,6 +111,21 @@ inline void Game::displayKeyboard(bool display)
     Platform::displayKeyboard(display);
 }
 
+inline unsigned int Game::getAttachedGamepads()
+{
+    Platform::getGamepadCount();
+    unsigned int gamepadCount = 0;
+
+    for (std::vector<Gamepad*>::iterator itr = _gamepads->begin(); itr != _gamepads->end(); itr++)
+    {
+        Gamepad* gamepad = (*itr);
+        if (gamepad->isAttached())
+            gamepadCount++;
+    }
+    
+    return gamepadCount;
+}
+
 inline unsigned int Game::getGamepadCount() const
 {
     return _gamepads->size();

+ 111 - 31
gameplay/src/Gamepad.cpp

@@ -5,24 +5,26 @@
 namespace gameplay
 {
 
-Gamepad::Gamepad(const char* id)
-    : _id(id), _gamepadForm(NULL)
-{
-}
-
-Gamepad::Gamepad(const char* id, const char* formPath)
-    : _id(id), _gamepadForm(NULL)
+Gamepad::Gamepad(unsigned int handle, const char* formPath)
+    : _id(""), _handle(handle), _buttonCount(0), _joystickCount(0), _triggerCount(0), _gamepadForm(NULL),
+      _uiJoysticks(NULL), _uiButtons(NULL)
 {
     GP_ASSERT(formPath);
 
     _gamepadForm = Form::create(formPath);
     GP_ASSERT(_gamepadForm);
-    
-    _gamepadForm->setConsumeInputEvents(false);
+
+    _id = _gamepadForm->getId();
 
     bindGamepadControls(_gamepadForm);
 }
 
+Gamepad::Gamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount)
+    : _id(id), _handle(handle), _buttonCount(buttonCount), _joystickCount(joystickCount), _triggerCount(triggerCount),
+      _gamepadForm(NULL), _uiJoysticks(NULL), _uiButtons(NULL)
+{
+}
+
 void Gamepad::bindGamepadControls(Container* container)
 {
     std::vector<Control*> controls = container->getControls();
@@ -40,31 +42,50 @@ void Gamepad::bindGamepadControls(Container* container)
         else if (std::strcmp("joystick", control->getType()) == 0)
         {
             control->addRef();
-            _joysticks.push_back((Joystick*) control);
+            if (!_uiJoysticks)
+                _uiJoysticks = new std::vector<Joystick*>;
+
+            _uiJoysticks->push_back((Joystick*) control);
+            _joystickCount++;
         }
         else if (std::strcmp("button", control->getType()) == 0)
         {
             control->addRef();
-            _buttons.push_back((Button*) control);
+            if (!_uiButtons)
+                _uiButtons = new std::vector<Button*>;
+
+            _uiButtons->push_back((Button*) control);
+            _buttonCount++;
         }   
     }
 }
 
 Gamepad::~Gamepad()
 {
-    for (std::vector<Joystick*>::iterator itr = _joysticks.begin(); itr != _joysticks.end(); itr++)
+    if (_gamepadForm)
     {
-        SAFE_RELEASE((*itr));
-    }
-    _joysticks.clear();
+        if (_uiJoysticks)
+        {
+            for (std::vector<Joystick*>::iterator itr = _uiJoysticks->begin(); itr != _uiJoysticks->end(); itr++)
+            {
+                SAFE_RELEASE((*itr));
+            }
+            _uiJoysticks->clear();
+            SAFE_DELETE(_uiJoysticks);
+        }
 
-    for (std::vector<Button*>::iterator itr = _buttons.begin(); itr!= _buttons.end(); itr++)
-    {
-        SAFE_RELEASE((*itr));
+        if (_uiButtons)
+        {
+            for (std::vector<Button*>::iterator itr = _uiButtons->begin(); itr!= _uiButtons->end(); itr++)
+            {
+                SAFE_RELEASE((*itr));
+            }
+            _uiButtons->clear();
+            SAFE_DELETE(_uiButtons);
+        }
+        
+        SAFE_RELEASE(_gamepadForm);
     }
-    _buttons.clear();
-
-    SAFE_RELEASE(_gamepadForm);
 }
 
 const char* Gamepad::getId() const
@@ -78,6 +99,10 @@ void Gamepad::update(float elapsedTime)
     {
         _gamepadForm->update(elapsedTime);
     }
+    else
+    {
+        isAttached();
+    }
 }
 
 void Gamepad::draw()
@@ -90,38 +115,81 @@ void Gamepad::draw()
 
 unsigned int Gamepad::getButtonCount() const
 {
-    return _buttons.size();
+    return _buttonCount;
 }
 
 Gamepad::ButtonState Gamepad::getButtonState(unsigned int buttonId) const
 {
-    GP_ASSERT(buttonId < _buttons.size());
+    GP_ASSERT(buttonId < _buttonCount);
 
-    return _buttons[buttonId]->getState() == Control::ACTIVE ? BUTTON_PRESSED : BUTTON_RELEASED;
+    if (_gamepadForm)
+    {
+        if (_uiButtons)
+            return _uiButtons->at(buttonId)->getState() == Control::ACTIVE ? BUTTON_PRESSED : BUTTON_RELEASED;
+        else
+            return BUTTON_RELEASED;
+    }
+    else
+        return Platform::getGamepadButtonState(_handle, buttonId) ? BUTTON_PRESSED : BUTTON_RELEASED;
 }
 
 unsigned int Gamepad::getJoystickCount() const
 {
-    return _joysticks.size();
+    return _joystickCount;
 }
 
 bool Gamepad::isJoystickActive(unsigned int joystickId) const
 {
-    GP_ASSERT(joystickId < _joysticks.size());
+    GP_ASSERT(joystickId < _joystickCount);
+
+    if (_gamepadForm)
+    {
+        if (_uiJoysticks)
+            return !_uiJoysticks->at(joystickId)->getValue().isZero();
+        else
+            return false;
+    }
+    else
+    {
+        return Platform::isGamepadJoystickActive(_handle, joystickId);
+    }
+}
+
+void Gamepad::getJoystickValue(unsigned int joystickId, Vector2* outValue) const
+{
+    GP_ASSERT(joystickId < _joystickCount);
 
-    return !_joysticks[joystickId]->getValue().isZero();
+    if (_gamepadForm)
+    {
+        if (_uiJoysticks)
+        {
+            const Vector2& value = _uiJoysticks->at(joystickId)->getValue();
+            outValue->set(value.x, value.y);
+        }
+        else
+        {
+            outValue->set(0.0f, 0.0f);
+        }
+    }
+    else
+    {
+        Platform::getGamepadJoystickValue(_handle, joystickId, outValue);
+    }
 }
 
-const Vector2& Gamepad::getJoystickValue(unsigned int joystickId) const
+float Gamepad::getJoystickXAxis(unsigned int joystickId) const
 {
-    GP_ASSERT(joystickId < _joysticks.size());
+    return Platform::getGamepadJoystickXAxis(_handle, joystickId);
+}
 
-    return _joysticks[joystickId]->getValue();
+float Gamepad::getJoystickYAxis(unsigned int joystickId) const
+{
+    return Platform::getGamepadJoystickYAxis(_handle, joystickId);
 }
 
 bool Gamepad::isVirtual() const
 {
-    return true;
+    return _gamepadForm;
 }
 
 Form* Gamepad::getForm() const
@@ -129,4 +197,16 @@ Form* Gamepad::getForm() const
     return _gamepadForm;
 }
 
+bool Gamepad::isAttached() const
+{
+    if (_gamepadForm)
+    {
+        return true;
+    }
+    else
+    {
+        return Platform::isGamepadAttached(_handle);
+    }
+}
+
 }

+ 47 - 16
gameplay/src/Gamepad.h

@@ -13,6 +13,7 @@ namespace gameplay
  */
 class Gamepad
 {
+    friend class Platform;
     friend class Game;
     friend class Control;
 
@@ -24,7 +25,7 @@ public:
     enum GamepadEvent
     {
         ATTACHED_EVENT,
-        DETACHED_EVENT,
+        DETACHED_EVENT
     };
 
     /**
@@ -76,10 +77,26 @@ public:
     /**
      * Returns the specified joystick's value as a Vector2.
      *
-     * @param joystickId The unique integer ID of the joystick to set.
-     * @return A Vector2 of the joystick displacement for the specified joystick.
+     * @param joystickId The index of the joystick to get the value for.
+     * @param outValue The current displacement of the joystick.
      */
-    const Vector2& getJoystickValue(unsigned int joystickId) const;
+    void getJoystickValue(unsigned int joystickId, Vector2* outValue) const;
+
+    /**
+     * Returns the specified joystick's x-axis value.
+     *
+     * @param joystickId The index of the joystick to get the x-axis value for.
+     * @return The current value of the joystick's x-axis value.
+     */
+    float getJoystickXAxis(unsigned int joystickId) const;
+    
+    /**
+     * Returns the specified joystick's y-axis value.
+     * 
+     * @param joystickId The index of the joystick to get the y-axis value for.
+     * @return The current value of the joystick's y-axis value.
+     */
+    float getJoystickYAxis(unsigned int joystickId) const;
 
     /**
      * Returns whether the gamepad is currently represented with a UI form or not.
@@ -110,20 +127,23 @@ public:
 
 private:
 
-    /**
-     * Constructor.
-     * 
-     * @param id The gamepad's id.
-     */
-    Gamepad(const char* id);
-    
     /**
      * Constructs a gamepad from the specified .form file.
      *
      * @param id The gamepad's id.
      * @param formPath The path the the .form file.
      */ 
-    Gamepad(const char* id, const char* formPath);
+    Gamepad(unsigned int handle, const char* formPath);
+
+    /**
+     * Constructs a physical gamepad.
+     *
+     * @param id The gamepad's id.
+     * @param buttonCount the number of buttons on the gamepad. 
+     * @param joystickCount the number of joysticks on the gamepad.
+     * @param triggerCount the number of triggers on the gamepad.
+     */
+    Gamepad(const char* id, unsigned int handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount);
 
     /**
      * Copy constructor.
@@ -134,16 +154,27 @@ private:
      * Destructor.
      */
     virtual ~Gamepad();
-
+    
     /** 
      * Binds the Joystick and Button Control object's from the specified container.
      */
     void bindGamepadControls(Container* container);
 
-    std::string _id;
-    std::vector<Joystick*> _joysticks;
-    std::vector<Button*> _buttons;
+    /**
+     * Gets whether the Gamepad is currently connected to the Platform.
+     */
+    bool isAttached() const;
+        
+    std::string _id;              // ID of the Gamepad
+    unsigned int _handle;         // The handle of the Gamepad.
+    unsigned int _buttonCount;    // Number of buttons.
+    unsigned int _joystickCount;  // Number of joysticks.
+    unsigned int _triggerCount;   // Number of triggers.
+    
+    // Data needed for virtual gamepads.
     Form* _gamepadForm;
+    std::vector<Joystick*>* _uiJoysticks;
+    std::vector<Button*>* _uiButtons;
 };
 
 }

+ 104 - 1
gameplay/src/Platform.h

@@ -4,6 +4,8 @@
 #include "Touch.h"
 #include "Keyboard.h"
 #include "Mouse.h"
+#include "Vector2.h"
+#include "Gamepad.h"
 
 namespace gameplay
 {
@@ -176,6 +178,107 @@ public:
      */
     static void displayKeyboard(bool display);
 
+    /** 
+     * Gets the number of gamepad devices connected to the Platform.
+     *
+     * Note: Calling this method also checks if any gamepads have been attached to or detached from the Platform 
+     *
+     * @return the number of gamepads connected to the Platform.
+     */
+    static unsigned int getGamepadCount();
+
+    /**
+     * Gets whether the specified gamepad is attached to the Platform.
+     *
+     * @param gamepadHandle the handle to the gamepad.
+     */
+    static bool isGamepadAttached(unsigned int gamepadHandle);
+
+    /**
+     * Gets the specified gamepad's ID.
+     *
+     * @param gamepadHandle the handle to the gamepad.
+     * @return the ID of the specified gamepad.
+     */
+    static const char* getGamepadId(unsigned int gamepadHandle);
+
+    /**
+     * Gets the number of buttons on the specified gamepad.
+     * 
+     * @param gamepadHandle handle to the gamepad to get the number of buttons for.
+     * @return the number of buttons on the gamepad.
+     */
+    static unsigned int getGamepadButtonCount(unsigned int gamepadHandle);
+
+    /**
+     * Gets the button state for the specified gamepad and button index.
+     *
+     * @param gamepadHandle handle to the gamepad to query the button state for.
+     * @param buttonIndex the index to the button to retrieve the state for.
+     */
+    static bool getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex);
+
+    /**
+     * Gets the number of joysticks on the specified gamepad.
+     * 
+     * @param gamepadHandle handle to the gamepad to get the number of joysticks for.
+     * @return the number of joysticks supported on the gamepad.
+     */
+    static unsigned int getGamepadJoystickCount(unsigned int gamepadHandle);
+
+    /** 
+     * Returns whether the joystick on the specified gamepad is active.
+     *
+     * @param gamepadHandle The handle to the gamepad.
+     * @param joystickIndex The index of the joystick.
+     * @return true if the joystick is active; false if the joystick is inactive.
+     */
+    static bool isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex);
+
+    /**
+     * Gets the value of the joystick's x-axis on the specified joystick.
+     *
+     * @param gamepadHandle The handle to the gamepad.
+     * @param joystickIndex The index of the joystick.
+     * @return the value of the joystick's x-axis.
+     */
+    static float getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex);
+
+    /**
+     * Gets the value of the joystick's x-axis on the specified joystick.
+     *
+     * @param gamepadHandle The handle to the gamepad.
+     * @param joystickIndex The index of the joystick.
+     * @return the value of the joystick's x-axis.
+     */
+    static float getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex);
+
+    /**
+     * Gets the values for the specified gamepad and joystick index.
+     *
+     * @param gamepadHandle handle to the gamepad to query the joystick value for.
+     * @param joystickIndex the index to the joystick to retrieve the value for.
+     * @param outValue will be populated with the current value of the specified joystick.
+     */
+    static void getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value);
+
+    /**
+     * Gets the number of triggers on the specified gamepad.
+     *
+     * @param gamepadHandle handle to the gamepad to get the number of triggers for.
+     * @return the number of triggers supported on the gamepad.
+     */ 
+    static unsigned int getGamepadTriggerCount(unsigned int gamepadHandle);
+
+    /**
+     * Gets the value for the specified gamepad and trigger index.
+     *
+     * @param gamepadHandle handle to the gamepad to query the trigger value for.
+     * @param triggerIndex the index to the trigger to retrieve the value for.
+     * @return the value of the specified trigger.
+     */
+    static float getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex);
+
     /**
      * Touch callback on touch events. This method handles passing the touch event to the form or to the game.
      *
@@ -221,7 +324,7 @@ public:
      * @param ms How long to sleep (in milliseconds).
      */
     static void sleep(long ms);
-
+    
 private:
 
     /**

+ 60 - 0
gameplay/src/PlatformAndroid.cpp

@@ -1000,6 +1000,66 @@ void Platform::sleep(long ms)
     usleep(ms * 1000);
 }
 
+unsigned int Platform::getGamepadCount()
+{
+    return 0;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle)
+{
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return false;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    return 0.0f;
+}
+
 }
 
 #endif

+ 60 - 0
gameplay/src/PlatformLinux.cpp

@@ -804,6 +804,66 @@ void Platform::sleep(long ms)
     usleep(ms * 1000);
 }
 
+unsigned int Platform::getGamepadCount()
+{
+    return 0;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle)
+{
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return false;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    return 0.0f;
+}
+
 }
 
 #endif

+ 60 - 0
gameplay/src/PlatformMacOSX.mm

@@ -879,6 +879,66 @@ void Platform::sleep(long ms)
     usleep(ms * 1000);
 }
 
+unsigned int Platform::getGamepadCount()
+{
+    return 0;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle)
+{
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return false;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    return 0.0f;
+}
+
 }
 
 #endif

+ 60 - 0
gameplay/src/PlatformQNX.cpp

@@ -1196,6 +1196,66 @@ void Platform::sleep(long ms)
     usleep(ms * 1000);
 }
 
+unsigned int Platform::getGamepadCount()
+{
+    return 0;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle)
+{
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return false;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    return 0.0f;
+}
+
 }
 
 #endif

+ 369 - 0
gameplay/src/PlatformWin32.cpp

@@ -5,9 +5,13 @@
 #include "FileSystem.h"
 #include "Game.h"
 #include "Form.h"
+#include "Vector2.h"
 #include "ScriptController.h"
 #include <GL/wglew.h>
 #include <windowsx.h>
+#ifdef USE_XINPUT
+#include <XInput.h>
+#endif
 
 using gameplay::print;
 
@@ -29,6 +33,151 @@ static HGLRC __hrc = 0;
 static bool __mouseCaptured = false;
 static POINT __mouseCapturePoint = { 0, 0 };
 static bool __cursorVisible = true;
+static unsigned int _gamepadCount = 0;
+
+#ifdef USE_XINPUT
+struct XInputGamepad
+{
+    static const unsigned int BUTTON_COUNT = 14;
+    static const unsigned int JOYSTICK_COUNT = 2;
+    static const unsigned int TRIGGER_COUNT = 2;
+    std::string _id;
+    int _handle;
+    bool _isConnected;
+    XINPUT_STATE _xState;
+};
+
+static XInputGamepad* _xInputGamepads;
+
+static DWORD getXInputGamepadButtonMask(unsigned int buttonHandle)
+{
+    switch(buttonHandle)
+    {
+    case 0:
+        return XINPUT_GAMEPAD_DPAD_UP;
+    case 1:
+        return XINPUT_GAMEPAD_DPAD_DOWN;
+    case 2:
+        return XINPUT_GAMEPAD_DPAD_LEFT;
+    case 3:
+        return XINPUT_GAMEPAD_DPAD_RIGHT;
+    case 4:
+        return XINPUT_GAMEPAD_START;
+    case 5:
+        return XINPUT_GAMEPAD_BACK;
+    case 6:
+        return XINPUT_GAMEPAD_LEFT_THUMB;
+    case 7:
+        return XINPUT_GAMEPAD_RIGHT_THUMB;
+    case 8:
+        return XINPUT_GAMEPAD_LEFT_SHOULDER;
+    case 9:
+        return XINPUT_GAMEPAD_RIGHT_SHOULDER;
+    case 10:
+        return XINPUT_GAMEPAD_A;
+    case 11:
+        return XINPUT_GAMEPAD_B;
+    case 12:
+        return XINPUT_GAMEPAD_X;
+    case 13:
+        return XINPUT_GAMEPAD_Y;
+    default:
+        return 0;
+    }
+}
+
+static bool getXInputState(unsigned long xInputHandle)
+{
+    GP_ASSERT(0 <= xInputHandle && xInputHandle < XUSER_MAX_COUNT);
+
+    if (XInputGetState((DWORD)xInputHandle, &_xInputGamepads[xInputHandle]._xState) == ERROR_SUCCESS)
+        return (_xInputGamepads[xInputHandle]._isConnected = true);
+    else
+        return (_xInputGamepads[xInputHandle]._isConnected = false);
+}
+
+static bool getXInputButtonState(unsigned long xInputHandle, unsigned long buttonHandle)
+{
+    GP_ASSERT(0 <= xInputHandle && xInputHandle < XUSER_MAX_COUNT);
+    GP_ASSERT(0 <= buttonHandle && buttonHandle < 14);
+    
+    WORD buttonMask = getXInputGamepadButtonMask(buttonHandle); // Conversion to button mask.
+
+    if ((_xInputGamepads[xInputHandle]._xState.Gamepad.wButtons & buttonMask) == buttonMask)
+        return true;
+    else
+        return false;
+}
+
+static int sign(int value)
+{
+    if (value < 0)
+        return -1;
+    else if (value > 0)
+        return 1;
+    else
+        return 0;
+}
+
+static float normalizeXInputJoystickAxis(int axisValue, int deadZone)
+{
+    int absAxisValue = abs(axisValue);
+
+    if (absAxisValue < deadZone)
+        return 0.0f;
+    else
+        return sign(axisValue) * (absAxisValue - deadZone) / (float)(32768 - deadZone);
+}
+
+static float getXInputJoystickXAxis(unsigned long xInputHandle, unsigned long joystickHandle)
+{
+    GP_ASSERT(0 <= xInputHandle && xInputHandle < XUSER_MAX_COUNT);
+    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
+    
+    switch(joystickHandle)
+    {
+    case 0:
+        return normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbLX, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+    case 1:
+        return normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbRX, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+    default: return 0.0f;
+    }
+}
+
+static float getXInputJoystickYAxis(unsigned long xInputHandle, unsigned long joystickHandle)
+{
+    GP_ASSERT(0 <= xInputHandle && xInputHandle < XUSER_MAX_COUNT);
+    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
+
+    switch(joystickHandle)
+    {
+    case 0:
+        return normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbLY, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+    case 1:
+        return normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbRY, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+    default: return 0.0f;
+    }
+}
+
+static void getXInputJoystickValue(unsigned long xInputHandle, unsigned long joystickHandle, gameplay::Vector2* value)
+{
+    GP_ASSERT(0 <= xInputHandle && xInputHandle < XUSER_MAX_COUNT);
+    GP_ASSERT(0 <= joystickHandle && joystickHandle < 2);
+
+    switch(joystickHandle)
+    {
+    case 0:
+        value->x = normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbLX, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+        value->y = normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbLY, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+        break;
+    case 1:
+        value->x = normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbRX, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+        value->y = normalizeXInputJoystickAxis(_xInputGamepads[xInputHandle]._xState.Gamepad.sThumbRY, XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
+        break;
+    }
+}
+
+#endif
 
 static gameplay::Keyboard::Key getKey(WPARAM win32KeyCode, bool shiftDown)
 {
@@ -472,6 +621,9 @@ Platform::~Platform()
         DestroyWindow(__hwnd);
         __hwnd = 0;
     }
+#ifdef USE_XINPUT
+    SAFE_DELETE_ARRAY(_xInputGamepads);
+#endif
 }
 
 bool initializeGL()
@@ -661,6 +813,31 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             goto error;
     }
 
+#ifdef USE_XINPUT
+    // Initialize XInputGamepads.
+    _xInputGamepads = new XInputGamepad[XUSER_MAX_COUNT];
+    for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
+    {
+        switch(i)
+        {
+        case 0:
+            _xInputGamepads[i]._id = "XINPUT 1";
+            break;
+        case 1:
+            _xInputGamepads[i]._id = "XINPUT 2";
+            break;
+        case 2:
+            _xInputGamepads[i]._id = "XINPUT 3";
+            break;
+        case 3:
+            _xInputGamepads[i]._id = "XINPUT 4";
+            break;
+        }
+        _xInputGamepads[i]._isConnected = false;
+        _xInputGamepads[i]._handle = -1;
+    }
+#endif
+
     return platform;
 
 error:
@@ -842,6 +1019,198 @@ void Platform::displayKeyboard(bool display)
     // Do nothing.
 }
 
+unsigned int Platform::getGamepadCount()
+{
+    // Check to see what gamepads are connected.
+    // Check xbox 360 controllers
+    _gamepadCount = 0;
+
+#ifdef USE_XINPUT
+    for (unsigned int i = 0; i < XUSER_MAX_COUNT; i++)
+    {
+        if (isGamepadAttached(i))
+            _gamepadCount++;
+    }    
+#endif
+    return _gamepadCount;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+    Game* game = Game::getInstance();
+    GP_ASSERT(game);
+
+    if (_xInputGamepads[gamepadHandle]._handle == -1)
+        _xInputGamepads[gamepadHandle]._handle = game->createGamepad(_xInputGamepads[gamepadHandle]._id.c_str(), gamepadHandle, _xInputGamepads[gamepadHandle].BUTTON_COUNT, 
+            _xInputGamepads[gamepadHandle].JOYSTICK_COUNT, _xInputGamepads[gamepadHandle].TRIGGER_COUNT);
+
+    bool isConnected = _xInputGamepads[gamepadHandle]._isConnected;
+    if (getXInputState(gamepadHandle))
+    {
+        if (!isConnected)
+        {
+            _xInputGamepads[gamepadHandle]._isConnected = true;
+            
+            Gamepad* gamepad = game->getGamepad(_xInputGamepads[gamepadHandle]._handle);
+            GP_ASSERT(gamepad);
+            if (game->isInitialized())
+                game->gamepadEvent(Gamepad::ATTACHED_EVENT, game->getGamepad(_xInputGamepads[gamepadHandle]._handle)); 
+        }
+        return true;
+    }
+    else
+    {
+        if (isConnected)
+        {
+            // if it was connected, but now isn't pass the detached event to gamepadEvent()
+            _xInputGamepads[gamepadHandle]._isConnected = false;
+            
+            Gamepad* gamepad = game->getGamepad(_xInputGamepads[gamepadHandle]._handle);
+            GP_ASSERT(gamepad);
+            if (game->isInitialized())
+                game->gamepadEvent(Gamepad::DETACHED_EVENT, game->getGamepad(_xInputGamepads[gamepadHandle]._handle));
+        }
+        return false;
+    }
+#endif
+
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle) 
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    return _xInputGamepads[gamepadHandle]._id.c_str();
+#endif
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+    if (!_xInputGamepads[gamepadHandle]._isConnected)
+        return 0;
+
+    return XInputGamepad::BUTTON_COUNT;
+#endif
+
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+    return getXInputButtonState(gamepadHandle, buttonIndex);
+#endif
+
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    if (!_xInputGamepads[gamepadHandle]._isConnected)
+        return 0;
+
+    return XInputGamepad::JOYSTICK_COUNT;
+#endif
+
+    return 0;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    return getXInputJoystickXAxis(gamepadHandle, joystickIndex);
+#endif 
+
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    return getXInputJoystickYAxis(gamepadHandle, joystickIndex);
+#endif
+
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+    
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    getXInputJoystickValue(gamepadHandle, joystickIndex, value);
+#endif
+
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    return (getXInputJoystickXAxis(gamepadHandle, joystickIndex) != 0.0f || getXInputJoystickYAxis(gamepadHandle, joystickIndex) != 0.0f);
+#endif 
+
+    return false;
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+
+    return XInputGamepad::TRIGGER_COUNT;
+#endif
+
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    
+#ifdef USE_XINPUT
+    GP_ASSERT(0 <= gamepadHandle);
+    GP_ASSERT(gamepadHandle < XUSER_MAX_COUNT);
+    //TODO:
+#endif
+    return 0.0f;
+}
+
 void Platform::touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex)
 {
     if (!Form::touchEventInternal(evt, x, y, contactIndex))

+ 60 - 0
gameplay/src/PlatformiOS.mm

@@ -988,6 +988,66 @@ void Platform::sleep(long ms)
 {
     usleep(ms * 1000);
 }
+
+unsigned int Platform::getGamepadCount()
+{
+    return 0;
+}
+
+bool Platform::isGamepadAttached(unsigned int gamepadHandle)
+{
+    return false;
+}
+
+const char* Platform::getGamepadId(unsigned int gamepadHandle)
+{
+    return NULL;
+}
+
+unsigned int Platform::getGamepadButtonCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::getGamepadButtonState(unsigned int gamepadHandle, unsigned int buttonIndex)
+{
+    return false;
+}
+
+unsigned int Platform::getGamepadJoystickCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+bool Platform::isGamepadJoystickActive(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return false;
+}
+
+float Platform::getGamepadJoystickXAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+float Platform::getGamepadJoystickYAxis(unsigned int gamepadHandle, unsigned int joystickIndex)
+{
+    return 0.0f;
+}
+
+void Platform::getGamepadJoystickValue(unsigned int gamepadHandle, unsigned int joystickIndex, Vector2* value)
+{
+
+}
+
+unsigned int Platform::getGamepadTriggerCount(unsigned int gamepadHandle)
+{
+    return 0;
+}
+
+float Platform::getGamepadTriggerValue(unsigned int gamepadHandle, unsigned int triggerIndex)
+{
+    return 0.0f;
+}
     
 }
 

+ 17 - 0
gameplay/src/RadioButton.cpp

@@ -28,6 +28,8 @@ RadioButton* RadioButton::create(const char* id, Theme::Style* style)
         radioButton->_id = id;
     radioButton->setStyle(style);
 
+    __radioButtons.push_back(radioButton);
+
     return radioButton;
 }
 
@@ -62,6 +64,11 @@ bool RadioButton::isSelected() const
     return _selected;
 }
 
+void RadioButton::setSelected(bool selected)
+{
+    _selected = selected;
+}
+
 void RadioButton::setImageSize(float width, float height)
 {
     _imageSize.set(width, height);
@@ -198,4 +205,14 @@ const char* RadioButton::getType() const
     return "radioButton";
 }
 
+void RadioButton::setGroupId(const char* groupId)
+{
+    _groupId = groupId;
+}
+
+const char* RadioButton::getGroupId() const
+{
+    return _groupId.c_str();
+}
+
 }

+ 18 - 0
gameplay/src/RadioButton.h

@@ -58,6 +58,11 @@ public:
      */
     bool isSelected() const;
 
+    /**
+     * Sets whether this radio button is currently selected.
+     */
+    void setSelected(bool selected);
+
     /**
      * Set the size to draw the radio button icon.
      *
@@ -90,6 +95,19 @@ public:
      */
     virtual void addListener(Control::Listener* listener, int eventFlags);
 
+    /**
+     *
+     * @param groupId
+     */
+    void setGroupId(const char* groupId);
+
+    /**
+     * Gets the RadioButton's group ID.
+     *
+     * @return the RadioButton's group ID.
+     */
+    const char* getGroupId() const;
+
 protected:
 
     /**

+ 78 - 0
gameplay/src/lua/lua_Button.cpp

@@ -88,6 +88,7 @@ void luaRegister_Button()
         {"setFocusIndex", lua_Button_setFocusIndex},
         {"setFont", lua_Button_setFont},
         {"setFontSize", lua_Button_setFontSize},
+        {"setHeight", lua_Button_setHeight},
         {"setImageColor", lua_Button_setImageColor},
         {"setImageRegion", lua_Button_setImageRegion},
         {"setMargin", lua_Button_setMargin},
@@ -103,6 +104,7 @@ void luaRegister_Button()
         {"setTextAlignment", lua_Button_setTextAlignment},
         {"setTextColor", lua_Button_setTextColor},
         {"setTextRightToLeft", lua_Button_setTextRightToLeft},
+        {"setWidth", lua_Button_setWidth},
         {"setZIndex", lua_Button_setZIndex},
         {NULL, NULL}
     };
@@ -3382,6 +3384,44 @@ int lua_Button_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Button_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Button_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4192,6 +4232,44 @@ int lua_Button_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Button_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Button_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -69,6 +69,7 @@ int lua_Button_setCursorRegion(lua_State* state);
 int lua_Button_setFocusIndex(lua_State* state);
 int lua_Button_setFont(lua_State* state);
 int lua_Button_setFontSize(lua_State* state);
+int lua_Button_setHeight(lua_State* state);
 int lua_Button_setImageColor(lua_State* state);
 int lua_Button_setImageRegion(lua_State* state);
 int lua_Button_setMargin(lua_State* state);
@@ -84,6 +85,7 @@ int lua_Button_setText(lua_State* state);
 int lua_Button_setTextAlignment(lua_State* state);
 int lua_Button_setTextColor(lua_State* state);
 int lua_Button_setTextRightToLeft(lua_State* state);
+int lua_Button_setWidth(lua_State* state);
 int lua_Button_setZIndex(lua_State* state);
 int lua_Button_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Button_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_CheckBox.cpp

@@ -93,6 +93,7 @@ void luaRegister_CheckBox()
         {"setFocusIndex", lua_CheckBox_setFocusIndex},
         {"setFont", lua_CheckBox_setFont},
         {"setFontSize", lua_CheckBox_setFontSize},
+        {"setHeight", lua_CheckBox_setHeight},
         {"setImageColor", lua_CheckBox_setImageColor},
         {"setImageRegion", lua_CheckBox_setImageRegion},
         {"setImageSize", lua_CheckBox_setImageSize},
@@ -109,6 +110,7 @@ void luaRegister_CheckBox()
         {"setTextAlignment", lua_CheckBox_setTextAlignment},
         {"setTextColor", lua_CheckBox_setTextColor},
         {"setTextRightToLeft", lua_CheckBox_setTextRightToLeft},
+        {"setWidth", lua_CheckBox_setWidth},
         {"setZIndex", lua_CheckBox_setZIndex},
         {NULL, NULL}
     };
@@ -3546,6 +3548,44 @@ int lua_CheckBox_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_CheckBox_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4398,6 +4438,44 @@ int lua_CheckBox_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_CheckBox_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -73,6 +73,7 @@ int lua_CheckBox_setCursorRegion(lua_State* state);
 int lua_CheckBox_setFocusIndex(lua_State* state);
 int lua_CheckBox_setFont(lua_State* state);
 int lua_CheckBox_setFontSize(lua_State* state);
+int lua_CheckBox_setHeight(lua_State* state);
 int lua_CheckBox_setImageColor(lua_State* state);
 int lua_CheckBox_setImageRegion(lua_State* state);
 int lua_CheckBox_setImageSize(lua_State* state);
@@ -89,6 +90,7 @@ int lua_CheckBox_setText(lua_State* state);
 int lua_CheckBox_setTextAlignment(lua_State* state);
 int lua_CheckBox_setTextColor(lua_State* state);
 int lua_CheckBox_setTextRightToLeft(lua_State* state);
+int lua_CheckBox_setWidth(lua_State* state);
 int lua_CheckBox_setZIndex(lua_State* state);
 int lua_CheckBox_static_ANIMATE_OPACITY(lua_State* state);
 int lua_CheckBox_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Container.cpp

@@ -107,6 +107,7 @@ void luaRegister_Container()
         {"setFocusIndex", lua_Container_setFocusIndex},
         {"setFont", lua_Container_setFont},
         {"setFontSize", lua_Container_setFontSize},
+        {"setHeight", lua_Container_setHeight},
         {"setImageColor", lua_Container_setImageColor},
         {"setImageRegion", lua_Container_setImageRegion},
         {"setMargin", lua_Container_setMargin},
@@ -123,6 +124,7 @@ void luaRegister_Container()
         {"setTextAlignment", lua_Container_setTextAlignment},
         {"setTextColor", lua_Container_setTextColor},
         {"setTextRightToLeft", lua_Container_setTextRightToLeft},
+        {"setWidth", lua_Container_setWidth},
         {"setZIndex", lua_Container_setZIndex},
         {NULL, NULL}
     };
@@ -3739,6 +3741,44 @@ int lua_Container_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Container_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Container* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Container_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4587,6 +4627,44 @@ int lua_Container_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Container_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Container* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Container_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -76,6 +76,7 @@ int lua_Container_setCursorRegion(lua_State* state);
 int lua_Container_setFocusIndex(lua_State* state);
 int lua_Container_setFont(lua_State* state);
 int lua_Container_setFontSize(lua_State* state);
+int lua_Container_setHeight(lua_State* state);
 int lua_Container_setImageColor(lua_State* state);
 int lua_Container_setImageRegion(lua_State* state);
 int lua_Container_setMargin(lua_State* state);
@@ -92,6 +93,7 @@ int lua_Container_setStyle(lua_State* state);
 int lua_Container_setTextAlignment(lua_State* state);
 int lua_Container_setTextColor(lua_State* state);
 int lua_Container_setTextRightToLeft(lua_State* state);
+int lua_Container_setWidth(lua_State* state);
 int lua_Container_setZIndex(lua_State* state);
 int lua_Container_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Container_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Control.cpp

@@ -86,6 +86,7 @@ void luaRegister_Control()
         {"setFocusIndex", lua_Control_setFocusIndex},
         {"setFont", lua_Control_setFont},
         {"setFontSize", lua_Control_setFontSize},
+        {"setHeight", lua_Control_setHeight},
         {"setImageColor", lua_Control_setImageColor},
         {"setImageRegion", lua_Control_setImageRegion},
         {"setMargin", lua_Control_setMargin},
@@ -100,6 +101,7 @@ void luaRegister_Control()
         {"setTextAlignment", lua_Control_setTextAlignment},
         {"setTextColor", lua_Control_setTextColor},
         {"setTextRightToLeft", lua_Control_setTextRightToLeft},
+        {"setWidth", lua_Control_setWidth},
         {"setZIndex", lua_Control_setZIndex},
         {NULL, NULL}
     };
@@ -3378,6 +3380,44 @@ int lua_Control_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Control_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Control* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Control_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4150,6 +4190,44 @@ int lua_Control_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Control_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Control* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Control_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -69,6 +69,7 @@ int lua_Control_setCursorRegion(lua_State* state);
 int lua_Control_setFocusIndex(lua_State* state);
 int lua_Control_setFont(lua_State* state);
 int lua_Control_setFontSize(lua_State* state);
+int lua_Control_setHeight(lua_State* state);
 int lua_Control_setImageColor(lua_State* state);
 int lua_Control_setImageRegion(lua_State* state);
 int lua_Control_setMargin(lua_State* state);
@@ -83,6 +84,7 @@ int lua_Control_setStyle(lua_State* state);
 int lua_Control_setTextAlignment(lua_State* state);
 int lua_Control_setTextColor(lua_State* state);
 int lua_Control_setTextRightToLeft(lua_State* state);
+int lua_Control_setWidth(lua_State* state);
 int lua_Control_setZIndex(lua_State* state);
 int lua_Control_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Control_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Form.cpp

@@ -112,6 +112,7 @@ void luaRegister_Form()
         {"setFocusIndex", lua_Form_setFocusIndex},
         {"setFont", lua_Form_setFont},
         {"setFontSize", lua_Form_setFontSize},
+        {"setHeight", lua_Form_setHeight},
         {"setImageColor", lua_Form_setImageColor},
         {"setImageRegion", lua_Form_setImageRegion},
         {"setMargin", lua_Form_setMargin},
@@ -129,6 +130,7 @@ void luaRegister_Form()
         {"setTextAlignment", lua_Form_setTextAlignment},
         {"setTextColor", lua_Form_setTextColor},
         {"setTextRightToLeft", lua_Form_setTextRightToLeft},
+        {"setWidth", lua_Form_setWidth},
         {"setZIndex", lua_Form_setZIndex},
         {"update", lua_Form_update},
         {NULL, NULL}
@@ -3827,6 +3829,44 @@ int lua_Form_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Form_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Form* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Form_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4713,6 +4753,44 @@ int lua_Form_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Form_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Form* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Form_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -78,6 +78,7 @@ int lua_Form_setCursorRegion(lua_State* state);
 int lua_Form_setFocusIndex(lua_State* state);
 int lua_Form_setFont(lua_State* state);
 int lua_Form_setFontSize(lua_State* state);
+int lua_Form_setHeight(lua_State* state);
 int lua_Form_setImageColor(lua_State* state);
 int lua_Form_setImageRegion(lua_State* state);
 int lua_Form_setMargin(lua_State* state);
@@ -95,6 +96,7 @@ int lua_Form_setStyle(lua_State* state);
 int lua_Form_setTextAlignment(lua_State* state);
 int lua_Form_setTextColor(lua_State* state);
 int lua_Form_setTextRightToLeft(lua_State* state);
+int lua_Form_setWidth(lua_State* state);
 int lua_Form_setZIndex(lua_State* state);
 int lua_Form_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Form_static_ANIMATE_POSITION(lua_State* state);

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

@@ -30,6 +30,7 @@ void luaRegister_Game()
         {"getAIController", lua_Game_getAIController},
         {"getAccelerometerValues", lua_Game_getAccelerometerValues},
         {"getAnimationController", lua_Game_getAnimationController},
+        {"getAttachedGamepads", lua_Game_getAttachedGamepads},
         {"getAudioController", lua_Game_getAudioController},
         {"getAudioListener", lua_Game_getAudioListener},
         {"getConfig", lua_Game_getConfig},
@@ -498,6 +499,43 @@ int lua_Game_getAnimationController(lua_State* state)
     return 0;
 }
 
+int lua_Game_getAttachedGamepads(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Game* instance = getInstance(state);
+                unsigned int result = instance->getAttachedGamepads();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Game_getAttachedGamepads - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Game_getAudioController(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -14,6 +14,7 @@ int lua_Game_gamepadEvent(lua_State* state);
 int lua_Game_getAIController(lua_State* state);
 int lua_Game_getAccelerometerValues(lua_State* state);
 int lua_Game_getAnimationController(lua_State* state);
+int lua_Game_getAttachedGamepads(lua_State* state);
 int lua_Game_getAudioController(lua_State* state);
 int lua_Game_getAudioListener(lua_State* state);
 int lua_Game_getConfig(lua_State* state);

+ 90 - 14
gameplay/src/lua/lua_Gamepad.cpp

@@ -20,6 +20,8 @@ void luaRegister_Gamepad()
         {"getId", lua_Gamepad_getId},
         {"getJoystickCount", lua_Gamepad_getJoystickCount},
         {"getJoystickValue", lua_Gamepad_getJoystickValue},
+        {"getJoystickXAxis", lua_Gamepad_getJoystickXAxis},
+        {"getJoystickYAxis", lua_Gamepad_getJoystickYAxis},
         {"isJoystickActive", lua_Gamepad_isJoystickActive},
         {"isVirtual", lua_Gamepad_isVirtual},
         {"update", lua_Gamepad_update},
@@ -275,6 +277,48 @@ int lua_Gamepad_getJoystickValue(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_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                Vector2* param2 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false);
+
+                Gamepad* instance = getInstance(state);
+                instance->getJoystickValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Gamepad_getJoystickValue - 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_Gamepad_getJoystickXAxis(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
@@ -287,25 +331,57 @@ int lua_Gamepad_getJoystickValue(lua_State* state)
                 unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
 
                 Gamepad* instance = getInstance(state);
-                void* returnPtr = (void*)&(instance->getJoystickValue(param1));
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Vector2");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
+                float result = instance->getJoystickXAxis(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
 
                 return 1;
             }
             else
             {
-                lua_pushstring(state, "lua_Gamepad_getJoystickValue - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_Gamepad_getJoystickXAxis - 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_Gamepad_getJoystickYAxis(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                Gamepad* instance = getInstance(state);
+                float result = instance->getJoystickYAxis(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Gamepad_getJoystickYAxis - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;

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

@@ -12,6 +12,8 @@ int lua_Gamepad_getForm(lua_State* state);
 int lua_Gamepad_getId(lua_State* state);
 int lua_Gamepad_getJoystickCount(lua_State* state);
 int lua_Gamepad_getJoystickValue(lua_State* state);
+int lua_Gamepad_getJoystickXAxis(lua_State* state);
+int lua_Gamepad_getJoystickYAxis(lua_State* state);
 int lua_Gamepad_isJoystickActive(lua_State* state);
 int lua_Gamepad_isVirtual(lua_State* state);
 int lua_Gamepad_update(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Joystick.cpp

@@ -91,6 +91,7 @@ void luaRegister_Joystick()
         {"setFocusIndex", lua_Joystick_setFocusIndex},
         {"setFont", lua_Joystick_setFont},
         {"setFontSize", lua_Joystick_setFontSize},
+        {"setHeight", lua_Joystick_setHeight},
         {"setImageColor", lua_Joystick_setImageColor},
         {"setImageRegion", lua_Joystick_setImageRegion},
         {"setInnerRegionSize", lua_Joystick_setInnerRegionSize},
@@ -108,6 +109,7 @@ void luaRegister_Joystick()
         {"setTextAlignment", lua_Joystick_setTextAlignment},
         {"setTextColor", lua_Joystick_setTextColor},
         {"setTextRightToLeft", lua_Joystick_setTextRightToLeft},
+        {"setWidth", lua_Joystick_setWidth},
         {"setZIndex", lua_Joystick_setZIndex},
         {NULL, NULL}
     };
@@ -3562,6 +3564,44 @@ int lua_Joystick_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Joystick* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joystick_setHeight - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4448,6 +4488,44 @@ int lua_Joystick_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Joystick* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joystick_setWidth - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -73,6 +73,7 @@ int lua_Joystick_setCursorRegion(lua_State* state);
 int lua_Joystick_setFocusIndex(lua_State* state);
 int lua_Joystick_setFont(lua_State* state);
 int lua_Joystick_setFontSize(lua_State* state);
+int lua_Joystick_setHeight(lua_State* state);
 int lua_Joystick_setImageColor(lua_State* state);
 int lua_Joystick_setImageRegion(lua_State* state);
 int lua_Joystick_setInnerRegionSize(lua_State* state);
@@ -90,6 +91,7 @@ int lua_Joystick_setStyle(lua_State* state);
 int lua_Joystick_setTextAlignment(lua_State* state);
 int lua_Joystick_setTextColor(lua_State* state);
 int lua_Joystick_setTextRightToLeft(lua_State* state);
+int lua_Joystick_setWidth(lua_State* state);
 int lua_Joystick_setZIndex(lua_State* state);
 int lua_Joystick_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Joystick_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Label.cpp

@@ -88,6 +88,7 @@ void luaRegister_Label()
         {"setFocusIndex", lua_Label_setFocusIndex},
         {"setFont", lua_Label_setFont},
         {"setFontSize", lua_Label_setFontSize},
+        {"setHeight", lua_Label_setHeight},
         {"setImageColor", lua_Label_setImageColor},
         {"setImageRegion", lua_Label_setImageRegion},
         {"setMargin", lua_Label_setMargin},
@@ -103,6 +104,7 @@ void luaRegister_Label()
         {"setTextAlignment", lua_Label_setTextAlignment},
         {"setTextColor", lua_Label_setTextColor},
         {"setTextRightToLeft", lua_Label_setTextRightToLeft},
+        {"setWidth", lua_Label_setWidth},
         {"setZIndex", lua_Label_setZIndex},
         {NULL, NULL}
     };
@@ -3419,6 +3421,44 @@ int lua_Label_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Label_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Label* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Label_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4229,6 +4269,44 @@ int lua_Label_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_Label_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Label* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Label_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -70,6 +70,7 @@ int lua_Label_setCursorRegion(lua_State* state);
 int lua_Label_setFocusIndex(lua_State* state);
 int lua_Label_setFont(lua_State* state);
 int lua_Label_setFontSize(lua_State* state);
+int lua_Label_setHeight(lua_State* state);
 int lua_Label_setImageColor(lua_State* state);
 int lua_Label_setImageRegion(lua_State* state);
 int lua_Label_setMargin(lua_State* state);
@@ -85,6 +86,7 @@ int lua_Label_setText(lua_State* state);
 int lua_Label_setTextAlignment(lua_State* state);
 int lua_Label_setTextColor(lua_State* state);
 int lua_Label_setTextRightToLeft(lua_State* state);
+int lua_Label_setWidth(lua_State* state);
 int lua_Label_setZIndex(lua_State* state);
 int lua_Label_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Label_static_ANIMATE_POSITION(lua_State* state);

+ 494 - 0
gameplay/src/lua/lua_Platform.cpp

@@ -23,8 +23,20 @@ void luaRegister_Platform()
         {"getAccelerometerValues", lua_Platform_static_getAccelerometerValues},
         {"getDisplayHeight", lua_Platform_static_getDisplayHeight},
         {"getDisplayWidth", lua_Platform_static_getDisplayWidth},
+        {"getGamepadButtonCount", lua_Platform_static_getGamepadButtonCount},
+        {"getGamepadButtonState", lua_Platform_static_getGamepadButtonState},
+        {"getGamepadCount", lua_Platform_static_getGamepadCount},
+        {"getGamepadId", lua_Platform_static_getGamepadId},
+        {"getGamepadJoystickCount", lua_Platform_static_getGamepadJoystickCount},
+        {"getGamepadJoystickValue", lua_Platform_static_getGamepadJoystickValue},
+        {"getGamepadJoystickXAxis", lua_Platform_static_getGamepadJoystickXAxis},
+        {"getGamepadJoystickYAxis", lua_Platform_static_getGamepadJoystickYAxis},
+        {"getGamepadTriggerCount", lua_Platform_static_getGamepadTriggerCount},
+        {"getGamepadTriggerValue", lua_Platform_static_getGamepadTriggerValue},
         {"hasMouse", lua_Platform_static_hasMouse},
         {"isCursorVisible", lua_Platform_static_isCursorVisible},
+        {"isGamepadAttached", lua_Platform_static_isGamepadAttached},
+        {"isGamepadJoystickActive", lua_Platform_static_isGamepadJoystickActive},
         {"isMouseCaptured", lua_Platform_static_isMouseCaptured},
         {"isMultiTouch", lua_Platform_static_isMultiTouch},
         {"isVsync", lua_Platform_static_isVsync},
@@ -290,6 +302,406 @@ int lua_Platform_static_getDisplayWidth(lua_State* state)
     return 0;
 }
 
+int lua_Platform_static_getGamepadButtonCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                unsigned int result = Platform::getGamepadButtonCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadButtonCount - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadButtonState(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                bool result = Platform::getGamepadButtonState(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadButtonState - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 0:
+        {
+            unsigned int result = Platform::getGamepadCount();
+
+            // Push the return value onto the stack.
+            lua_pushunsigned(state, result);
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadId(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                const char* result = Platform::getGamepadId(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadId - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                unsigned int result = Platform::getGamepadJoystickCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadJoystickCount - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadJoystickValue(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 3 off the stack.
+                Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false);
+
+                Platform::getGamepadJoystickValue(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadJoystickValue - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                float result = Platform::getGamepadJoystickXAxis(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadJoystickXAxis - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadJoystickYAxis(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                float result = Platform::getGamepadJoystickYAxis(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadJoystickYAxis - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadTriggerCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                unsigned int result = Platform::getGamepadTriggerCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadTriggerCount - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_getGamepadTriggerValue(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                float result = Platform::getGamepadTriggerValue(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_getGamepadTriggerValue - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Platform_static_hasMouse(lua_State* state)
 {
     // Get the number of parameters.
@@ -346,6 +758,88 @@ int lua_Platform_static_isCursorVisible(lua_State* state)
     return 0;
 }
 
+int lua_Platform_static_isGamepadAttached(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                bool result = Platform::isGamepadAttached(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_isGamepadAttached - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Platform_static_isGamepadJoystickActive(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                bool result = Platform::isGamepadJoystickActive(param1, param2);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Platform_static_isGamepadJoystickActive - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Platform_static_isMouseCaptured(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -12,8 +12,20 @@ int lua_Platform_static_getAbsoluteTime(lua_State* state);
 int lua_Platform_static_getAccelerometerValues(lua_State* state);
 int lua_Platform_static_getDisplayHeight(lua_State* state);
 int lua_Platform_static_getDisplayWidth(lua_State* state);
+int lua_Platform_static_getGamepadButtonCount(lua_State* state);
+int lua_Platform_static_getGamepadButtonState(lua_State* state);
+int lua_Platform_static_getGamepadCount(lua_State* state);
+int lua_Platform_static_getGamepadId(lua_State* state);
+int lua_Platform_static_getGamepadJoystickCount(lua_State* state);
+int lua_Platform_static_getGamepadJoystickValue(lua_State* state);
+int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state);
+int lua_Platform_static_getGamepadJoystickYAxis(lua_State* state);
+int lua_Platform_static_getGamepadTriggerCount(lua_State* state);
+int lua_Platform_static_getGamepadTriggerValue(lua_State* state);
 int lua_Platform_static_hasMouse(lua_State* state);
 int lua_Platform_static_isCursorVisible(lua_State* state);
+int lua_Platform_static_isGamepadAttached(lua_State* state);
+int lua_Platform_static_isGamepadJoystickActive(lua_State* state);
 int lua_Platform_static_isMouseCaptured(lua_State* state);
 int lua_Platform_static_isMultiTouch(lua_State* state);
 int lua_Platform_static_isVsync(lua_State* state);

+ 194 - 0
gameplay/src/lua/lua_RadioButton.cpp

@@ -52,6 +52,7 @@ void luaRegister_RadioButton()
         {"getFocusIndex", lua_RadioButton_getFocusIndex},
         {"getFont", lua_RadioButton_getFont},
         {"getFontSize", lua_RadioButton_getFontSize},
+        {"getGroupId", lua_RadioButton_getGroupId},
         {"getHeight", lua_RadioButton_getHeight},
         {"getId", lua_RadioButton_getId},
         {"getImageColor", lua_RadioButton_getImageColor},
@@ -92,6 +93,8 @@ void luaRegister_RadioButton()
         {"setFocusIndex", lua_RadioButton_setFocusIndex},
         {"setFont", lua_RadioButton_setFont},
         {"setFontSize", lua_RadioButton_setFontSize},
+        {"setGroupId", lua_RadioButton_setGroupId},
+        {"setHeight", lua_RadioButton_setHeight},
         {"setImageColor", lua_RadioButton_setImageColor},
         {"setImageRegion", lua_RadioButton_setImageRegion},
         {"setImageSize", lua_RadioButton_setImageSize},
@@ -99,6 +102,7 @@ void luaRegister_RadioButton()
         {"setOpacity", lua_RadioButton_setOpacity},
         {"setPadding", lua_RadioButton_setPadding},
         {"setPosition", lua_RadioButton_setPosition},
+        {"setSelected", lua_RadioButton_setSelected},
         {"setSize", lua_RadioButton_setSize},
         {"setSkinColor", lua_RadioButton_setSkinColor},
         {"setSkinRegion", lua_RadioButton_setSkinRegion},
@@ -108,6 +112,7 @@ void luaRegister_RadioButton()
         {"setTextAlignment", lua_RadioButton_setTextAlignment},
         {"setTextColor", lua_RadioButton_setTextColor},
         {"setTextRightToLeft", lua_RadioButton_setTextRightToLeft},
+        {"setWidth", lua_RadioButton_setWidth},
         {"setZIndex", lua_RadioButton_setZIndex},
         {NULL, NULL}
     };
@@ -1598,6 +1603,43 @@ int lua_RadioButton_getFontSize(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_getGroupId(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);
+                const char* result = instance->getGroupId();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_getGroupId - 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_getHeight(lua_State* state)
 {
     // Get the number of parameters.
@@ -3507,6 +3549,82 @@ int lua_RadioButton_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_setGroupId(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                RadioButton* instance = getInstance(state);
+                instance->setGroupId(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_setGroupId - 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_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                RadioButton* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3893,6 +4011,44 @@ int lua_RadioButton_setPosition(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_setSelected(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = ScriptUtil::luaCheckBool(state, 2);
+
+                RadioButton* instance = getInstance(state);
+                instance->setSelected(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_setSelected - 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_setSize(lua_State* state)
 {
     // Get the number of parameters.
@@ -4359,6 +4515,44 @@ int lua_RadioButton_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                RadioButton* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

+ 5 - 0
gameplay/src/lua/lua_RadioButton.h

@@ -32,6 +32,7 @@ int lua_RadioButton_getCursorUVs(lua_State* state);
 int lua_RadioButton_getFocusIndex(lua_State* state);
 int lua_RadioButton_getFont(lua_State* state);
 int lua_RadioButton_getFontSize(lua_State* state);
+int lua_RadioButton_getGroupId(lua_State* state);
 int lua_RadioButton_getHeight(lua_State* state);
 int lua_RadioButton_getId(lua_State* state);
 int lua_RadioButton_getImageColor(lua_State* state);
@@ -72,6 +73,8 @@ int lua_RadioButton_setCursorRegion(lua_State* state);
 int lua_RadioButton_setFocusIndex(lua_State* state);
 int lua_RadioButton_setFont(lua_State* state);
 int lua_RadioButton_setFontSize(lua_State* state);
+int lua_RadioButton_setGroupId(lua_State* state);
+int lua_RadioButton_setHeight(lua_State* state);
 int lua_RadioButton_setImageColor(lua_State* state);
 int lua_RadioButton_setImageRegion(lua_State* state);
 int lua_RadioButton_setImageSize(lua_State* state);
@@ -79,6 +82,7 @@ int lua_RadioButton_setMargin(lua_State* state);
 int lua_RadioButton_setOpacity(lua_State* state);
 int lua_RadioButton_setPadding(lua_State* state);
 int lua_RadioButton_setPosition(lua_State* state);
+int lua_RadioButton_setSelected(lua_State* state);
 int lua_RadioButton_setSize(lua_State* state);
 int lua_RadioButton_setSkinColor(lua_State* state);
 int lua_RadioButton_setSkinRegion(lua_State* state);
@@ -88,6 +92,7 @@ int lua_RadioButton_setText(lua_State* state);
 int lua_RadioButton_setTextAlignment(lua_State* state);
 int lua_RadioButton_setTextColor(lua_State* state);
 int lua_RadioButton_setTextRightToLeft(lua_State* state);
+int lua_RadioButton_setWidth(lua_State* state);
 int lua_RadioButton_setZIndex(lua_State* state);
 int lua_RadioButton_static_ANIMATE_OPACITY(lua_State* state);
 int lua_RadioButton_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_Slider.cpp

@@ -93,6 +93,7 @@ void luaRegister_Slider()
         {"setFocusIndex", lua_Slider_setFocusIndex},
         {"setFont", lua_Slider_setFont},
         {"setFontSize", lua_Slider_setFontSize},
+        {"setHeight", lua_Slider_setHeight},
         {"setImageColor", lua_Slider_setImageColor},
         {"setImageRegion", lua_Slider_setImageRegion},
         {"setMargin", lua_Slider_setMargin},
@@ -112,6 +113,7 @@ void luaRegister_Slider()
         {"setTextColor", lua_Slider_setTextColor},
         {"setTextRightToLeft", lua_Slider_setTextRightToLeft},
         {"setValue", lua_Slider_setValue},
+        {"setWidth", lua_Slider_setWidth},
         {"setZIndex", lua_Slider_setZIndex},
         {NULL, NULL}
     };
@@ -3576,6 +3578,44 @@ int lua_Slider_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_Slider_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Slider* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Slider_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4538,6 +4578,44 @@ int lua_Slider_setValue(lua_State* state)
     return 0;
 }
 
+int lua_Slider_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Slider* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Slider_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -74,6 +74,7 @@ int lua_Slider_setCursorRegion(lua_State* state);
 int lua_Slider_setFocusIndex(lua_State* state);
 int lua_Slider_setFont(lua_State* state);
 int lua_Slider_setFontSize(lua_State* state);
+int lua_Slider_setHeight(lua_State* state);
 int lua_Slider_setImageColor(lua_State* state);
 int lua_Slider_setImageRegion(lua_State* state);
 int lua_Slider_setMargin(lua_State* state);
@@ -93,6 +94,7 @@ int lua_Slider_setTextAlignment(lua_State* state);
 int lua_Slider_setTextColor(lua_State* state);
 int lua_Slider_setTextRightToLeft(lua_State* state);
 int lua_Slider_setValue(lua_State* state);
+int lua_Slider_setWidth(lua_State* state);
 int lua_Slider_setZIndex(lua_State* state);
 int lua_Slider_static_ANIMATE_OPACITY(lua_State* state);
 int lua_Slider_static_ANIMATE_POSITION(lua_State* state);

+ 78 - 0
gameplay/src/lua/lua_TextBox.cpp

@@ -90,6 +90,7 @@ void luaRegister_TextBox()
         {"setFocusIndex", lua_TextBox_setFocusIndex},
         {"setFont", lua_TextBox_setFont},
         {"setFontSize", lua_TextBox_setFontSize},
+        {"setHeight", lua_TextBox_setHeight},
         {"setImageColor", lua_TextBox_setImageColor},
         {"setImageRegion", lua_TextBox_setImageRegion},
         {"setMargin", lua_TextBox_setMargin},
@@ -105,6 +106,7 @@ void luaRegister_TextBox()
         {"setTextAlignment", lua_TextBox_setTextAlignment},
         {"setTextColor", lua_TextBox_setTextColor},
         {"setTextRightToLeft", lua_TextBox_setTextRightToLeft},
+        {"setWidth", lua_TextBox_setWidth},
         {"setZIndex", lua_TextBox_setZIndex},
         {NULL, NULL}
     };
@@ -3458,6 +3460,44 @@ int lua_TextBox_setFontSize(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_setHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                TextBox* instance = getInstance(state);
+                instance->setHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_TextBox_setHeight - 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_setImageColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -4268,6 +4308,44 @@ int lua_TextBox_setTextRightToLeft(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_setWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                TextBox* instance = getInstance(state);
+                instance->setWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_TextBox_setWidth - 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_setZIndex(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -71,6 +71,7 @@ int lua_TextBox_setCursorRegion(lua_State* state);
 int lua_TextBox_setFocusIndex(lua_State* state);
 int lua_TextBox_setFont(lua_State* state);
 int lua_TextBox_setFontSize(lua_State* state);
+int lua_TextBox_setHeight(lua_State* state);
 int lua_TextBox_setImageColor(lua_State* state);
 int lua_TextBox_setImageRegion(lua_State* state);
 int lua_TextBox_setMargin(lua_State* state);
@@ -86,6 +87,7 @@ int lua_TextBox_setText(lua_State* state);
 int lua_TextBox_setTextAlignment(lua_State* state);
 int lua_TextBox_setTextColor(lua_State* state);
 int lua_TextBox_setTextRightToLeft(lua_State* state);
+int lua_TextBox_setWidth(lua_State* state);
 int lua_TextBox_setZIndex(lua_State* state);
 int lua_TextBox_static_ANIMATE_OPACITY(lua_State* state);
 int lua_TextBox_static_ANIMATE_POSITION(lua_State* state);