Bläddra i källkod

Tweaks and fixes to Container behavior when a gamepad is used to interact with a form.
Modifications to the FormsTest and TestsGame in order to better support gamepads in the test app.
Keeping the lua bindings up-to-date.

Adam Blake 12 år sedan
förälder
incheckning
d1ff163f30

+ 81 - 48
gameplay/src/Container.cpp

@@ -51,7 +51,8 @@ Container::Container()
       _scrollingMouseVertically(false), _scrollingMouseHorizontally(false),
       _scrollBarOpacityClip(NULL), _zIndexDefault(0), _focusIndexDefault(0), _focusIndexMax(0),
       _focusPressed(0), _selectButtonDown(false),
-      _lastFrameTime(0), _focusChangeStartTime(0), _focusChangeRepeatDelay(FOCUS_CHANGE_REPEAT_DELAY), _focusChangeCount(0),
+      _lastFrameTime(0), _focusChangeRepeat(false),
+      _focusChangeStartTime(0), _focusChangeRepeatDelay(FOCUS_CHANGE_REPEAT_DELAY), _focusChangeCount(0),
       _totalWidth(0), _totalHeight(0),
       _contactIndices(0), _initializedWithScroll(false)
 {
@@ -645,8 +646,32 @@ bool Container::keyEvent(Keyboard::KeyEvent evt, int key)
     return false;
 }
 
+void Container::guaranteeFocus(Control* inFocus)
+{
+    std::vector<Control*>::const_iterator it;
+    for (it = _controls.begin(); it < _controls.end(); it++)
+    {
+        Control* control = *it;
+        GP_ASSERT(control);
+        if (control == inFocus)
+            continue;
+
+        if (control->isContainer())
+        {
+            ((Container*)control)->guaranteeFocus(inFocus);
+        }
+        else if (control->getState() == Control::FOCUS)
+        {
+            control->setState(NORMAL);
+            return;
+        }
+    }
+}
+
 bool Container::moveFocus(Direction direction, Control* outsideControl)
 {
+    _direction = direction;
+
     Control* start = outsideControl;
     if (!start)
     {
@@ -690,6 +715,8 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
             vStart.set(startBounds.right(),
                         startBounds.y + startBounds.height * 0.5f);
             break;
+        case NEXT:
+            break;
         }
 
         if (direction != NEXT)
@@ -746,7 +773,7 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
             if (!outsideControl && _parent && _parent->moveFocus(direction, start))
             {
                 setState(NORMAL);
-                _focusPressed = 0;
+                _focusChangeRepeat = false;
                 return true;
             }
             
@@ -809,7 +836,7 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
         {
             if (((Container*)next)->moveFocus(direction, start))
             {
-                _focusPressed = 0;
+                _focusChangeRepeat = false;
                 return true;
             }
         }
@@ -838,14 +865,16 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
             _scrollPosition.y = -(bounds.y + bounds.height - _viewportBounds.height);
         }
 
-        _focusChangeStartTime = Game::getAbsoluteTime();
         if (outsideControl && outsideControl->_parent)
         {
-            _focusPressed = direction;
+            _focusPressed = outsideControl->_parent->_focusPressed;
             _focusChangeCount = outsideControl->_parent->_focusChangeCount;
             _focusChangeRepeatDelay = outsideControl->_parent->_focusChangeRepeatDelay;
+            outsideControl->_parent->guaranteeFocus(next);
         }
 
+        _focusChangeStartTime = Game::getAbsoluteTime();
+        _focusChangeRepeat = true;
         addRef();
         Game::getInstance()->schedule(_focusChangeRepeatDelay, this);
 
@@ -858,7 +887,7 @@ bool Container::moveFocus(Direction direction, Control* outsideControl)
 void Container::timeEvent(long timeDiff, void* cookie)
 {
     double time = Game::getAbsoluteTime();
-    if (_state == FOCUS && _focusPressed &&
+    if (_focusChangeRepeat && _state == FOCUS && _focusPressed &&
         abs(time - timeDiff - _focusChangeRepeatDelay - _focusChangeStartTime) < 50)
     {
         ++_focusChangeCount;
@@ -866,7 +895,7 @@ void Container::timeEvent(long timeDiff, void* cookie)
         {
             _focusChangeRepeatDelay *= 0.5;
         }
-        moveFocus((Direction)_focusPressed);
+        moveFocus(_direction);
     }
     else
     {
@@ -918,10 +947,6 @@ bool Container::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsign
         if (control->getState() == Control::FOCUS || control->getState() == Control::ACTIVE)
         {
             eventConsumed |= control->gamepadEvent(evt, gamepad, analogIndex);
-            if (eventConsumed && !control->isContainer())
-            {
-                _focusPressed = 0;
-            }
             break;
         }
     }
@@ -933,7 +958,7 @@ bool Container::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsign
             gamepad->isButtonDown(Gamepad::BUTTON_X))
         {
             _selectButtonDown = true;
-            _focusPressed = 0;
+            _focusChangeRepeat = false;
             eventConsumed |= _consumeInputEvents;
         }
     }
@@ -1052,58 +1077,66 @@ bool Container::gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad, unsign
 
                 case 1:
                     // The right analog stick can be used to scroll.
-                    if (_scrolling)
+                    if (_scroll != SCROLL_NONE)
                     {
-                        if (joystick.isZero())
+                        if (_scrolling)
                         {
-                            stopScrolling();
+                            if (joystick.isZero())
+                            {
+                                stopScrolling();
+                            }
+                            else
+                            {
+                                startScrolling(GAMEPAD_SCROLL_SPEED * joystick.x, GAMEPAD_SCROLL_SPEED * joystick.y, false);
+                            }
                         }
                         else
                         {
-                            startScrolling(GAMEPAD_SCROLL_SPEED * joystick.x, GAMEPAD_SCROLL_SPEED * joystick.y, false);
+                            startScrolling(GAMEPAD_SCROLL_SPEED * joystick.x, GAMEPAD_SCROLL_SPEED * joystick.y);
                         }
+                        release();
+                        return _consumeInputEvents;
                     }
-                    else
-                    {
-                        startScrolling(GAMEPAD_SCROLL_SPEED * joystick.x, GAMEPAD_SCROLL_SPEED * joystick.y);
-                    }
-                    release();
-                    return _consumeInputEvents;
+                    break;
                 }
             }
         }
     }
 
-    if ((_focusPressed & DOWN) &&
-        !gamepad->isButtonDown(Gamepad::BUTTON_DOWN) &&
-        joystick.y > -JOYSTICK_THRESHOLD)
+    if ((evt == Gamepad::BUTTON_EVENT || evt == Gamepad::JOYSTICK_EVENT) &&
+        analogIndex == 0)
     {
-        _focusPressed &= ~DOWN;
-        eventConsumed |= _consumeInputEvents;
-    }
+        if ((_focusPressed & DOWN) &&
+            !gamepad->isButtonDown(Gamepad::BUTTON_DOWN) &&
+            joystick.y > -JOYSTICK_THRESHOLD)
+        {
+            _focusPressed &= ~DOWN;
+            eventConsumed |= _consumeInputEvents;
+        }
 
-    if ((_focusPressed & RIGHT) &&
-        !gamepad->isButtonDown(Gamepad::BUTTON_RIGHT) &&
-        joystick.x < JOYSTICK_THRESHOLD)
-    {
-        _focusPressed &= ~RIGHT;
-        eventConsumed |= _consumeInputEvents;
-    }
+        if ((_focusPressed & RIGHT) &&
+            !gamepad->isButtonDown(Gamepad::BUTTON_RIGHT) &&
+            joystick.x < JOYSTICK_THRESHOLD)
+        {
+            _focusPressed &= ~RIGHT;
+            eventConsumed |= _consumeInputEvents;
+        }
     
-    if ((_focusPressed & UP) &&
-        !gamepad->isButtonDown(Gamepad::BUTTON_UP) &&
-        joystick.y < JOYSTICK_THRESHOLD)
-    {
-        _focusPressed &= ~UP;
-        eventConsumed |= _consumeInputEvents;
-    }
+        if ((_focusPressed & UP) &&
+            !gamepad->isButtonDown(Gamepad::BUTTON_UP) &&
+            joystick.y < JOYSTICK_THRESHOLD)
+        {
+            _focusPressed &= ~UP;
+            eventConsumed |= _consumeInputEvents;
+        }
 
-    if ((_focusPressed & LEFT) &&
-        !gamepad->isButtonDown(Gamepad::BUTTON_LEFT) &&
-        joystick.x > -JOYSTICK_THRESHOLD)
-    {
-        _focusPressed &= ~LEFT;
-        eventConsumed |= _consumeInputEvents;
+        if ((_focusPressed & LEFT) &&
+            !gamepad->isButtonDown(Gamepad::BUTTON_LEFT) &&
+            joystick.x > -JOYSTICK_THRESHOLD)
+        {
+            _focusPressed &= ~LEFT;
+            eventConsumed |= _consumeInputEvents;
+        }
     }
 
     if (!_focusPressed && _scrolling)

+ 9 - 0
gameplay/src/Container.h

@@ -213,6 +213,11 @@ public:
      */
     virtual void setAnimationPropertyValue(int propertyId, AnimationValue* value, float blendWeight = 1.0f);
 
+    /**
+     * @see TimeListener::timeEvent
+     *
+     * @script{ignore}
+     */
     void timeEvent(long timeDiff, void* cookie);
 
 protected:
@@ -538,6 +543,8 @@ private:
     // in which case scrolling can be initiated.
     bool moveFocus(Direction direction, Control* outsideControl = NULL);
 
+    void guaranteeFocus(Control* inFocus);
+
     // Starts scrolling at the given horizontal and vertical speeds.
     void startScrolling(float x, float y, bool resetTime = true);
 
@@ -552,9 +559,11 @@ private:
     double _lastFrameTime;
 
     // Timing information for repeating focus changes.
+    bool _focusChangeRepeat;
     double _focusChangeStartTime;
     double _focusChangeRepeatDelay;
     unsigned int _focusChangeCount;
+    Direction _direction;
 
     float _totalWidth;
     float _totalHeight;

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

@@ -33,6 +33,7 @@ void luaRegister_Button()
         {"createAnimationFromBy", lua_Button_createAnimationFromBy},
         {"createAnimationFromTo", lua_Button_createAnimationFromTo},
         {"destroyAnimation", lua_Button_destroyAnimation},
+        {"getAbsoluteBounds", lua_Button_getAbsoluteBounds},
         {"getAlignment", lua_Button_getAlignment},
         {"getAnimation", lua_Button_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Button_getAnimationPropertyComponentCount},
@@ -680,6 +681,50 @@ int lua_Button_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Button_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Button* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Button_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_Button_createAnimation(lua_State* state);
 int lua_Button_createAnimationFromBy(lua_State* state);
 int lua_Button_createAnimationFromTo(lua_State* state);
 int lua_Button_destroyAnimation(lua_State* state);
+int lua_Button_getAbsoluteBounds(lua_State* state);
 int lua_Button_getAlignment(lua_State* state);
 int lua_Button_getAnimation(lua_State* state);
 int lua_Button_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -34,6 +34,7 @@ void luaRegister_CheckBox()
         {"createAnimationFromBy", lua_CheckBox_createAnimationFromBy},
         {"createAnimationFromTo", lua_CheckBox_createAnimationFromTo},
         {"destroyAnimation", lua_CheckBox_destroyAnimation},
+        {"getAbsoluteBounds", lua_CheckBox_getAbsoluteBounds},
         {"getAlignment", lua_CheckBox_getAlignment},
         {"getAnimation", lua_CheckBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_CheckBox_getAnimationPropertyComponentCount},
@@ -686,6 +687,50 @@ int lua_CheckBox_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                CheckBox* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_CheckBox_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_CheckBox_createAnimation(lua_State* state);
 int lua_CheckBox_createAnimationFromBy(lua_State* state);
 int lua_CheckBox_createAnimationFromTo(lua_State* state);
 int lua_CheckBox_destroyAnimation(lua_State* state);
+int lua_CheckBox_getAbsoluteBounds(lua_State* state);
 int lua_CheckBox_getAlignment(lua_State* state);
 int lua_CheckBox_getAnimation(lua_State* state);
 int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state);

+ 45 - 41
gameplay/src/lua/lua_Container.cpp

@@ -46,6 +46,7 @@ void luaRegister_Container()
         {"createAnimationFromBy", lua_Container_createAnimationFromBy},
         {"createAnimationFromTo", lua_Container_createAnimationFromTo},
         {"destroyAnimation", lua_Container_destroyAnimation},
+        {"getAbsoluteBounds", lua_Container_getAbsoluteBounds},
         {"getAlignment", lua_Container_getAlignment},
         {"getAnimation", lua_Container_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Container_getAnimationPropertyComponentCount},
@@ -130,7 +131,6 @@ void luaRegister_Container()
         {"setVisible", lua_Container_setVisible},
         {"setWidth", lua_Container_setWidth},
         {"setZIndex", lua_Container_setZIndex},
-        {"timeEvent", lua_Container_timeEvent},
         {NULL, NULL}
     };
     const luaL_Reg lua_statics[] = 
@@ -748,6 +748,50 @@ int lua_Container_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Container_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Container* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Container_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -5001,44 +5045,4 @@ int lua_Container_static_create(lua_State* state)
     return 0;
 }
 
-int lua_Container_timeEvent(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_TNONE)
-            {
-                // Get parameter 1 off the stack.
-                long param1 = (long)luaL_checklong(state, 2);
-
-                // Get parameter 2 off the stack.
-                void* param2 = (void*)luaL_checkint(state, 3);
-
-                Container* instance = getInstance(state);
-                instance->timeEvent(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Container_timeEvent - 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;
-}
-
 }

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

@@ -14,6 +14,7 @@ int lua_Container_createAnimation(lua_State* state);
 int lua_Container_createAnimationFromBy(lua_State* state);
 int lua_Container_createAnimationFromTo(lua_State* state);
 int lua_Container_destroyAnimation(lua_State* state);
+int lua_Container_getAbsoluteBounds(lua_State* state);
 int lua_Container_getAlignment(lua_State* state);
 int lua_Container_getAnimation(lua_State* state);
 int lua_Container_getAnimationPropertyComponentCount(lua_State* state);
@@ -107,7 +108,6 @@ int lua_Container_static_ANIMATE_SIZE(lua_State* state);
 int lua_Container_static_ANIMATE_SIZE_HEIGHT(lua_State* state);
 int lua_Container_static_ANIMATE_SIZE_WIDTH(lua_State* state);
 int lua_Container_static_create(lua_State* state);
-int lua_Container_timeEvent(lua_State* state);
 
 void luaRegister_Container();
 

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

@@ -30,6 +30,7 @@ void luaRegister_Control()
         {"createAnimationFromBy", lua_Control_createAnimationFromBy},
         {"createAnimationFromTo", lua_Control_createAnimationFromTo},
         {"destroyAnimation", lua_Control_destroyAnimation},
+        {"getAbsoluteBounds", lua_Control_getAbsoluteBounds},
         {"getAlignment", lua_Control_getAlignment},
         {"getAnimation", lua_Control_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Control_getAnimationPropertyComponentCount},
@@ -675,6 +676,50 @@ int lua_Control_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Control_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Control* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Control_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_Control_createAnimation(lua_State* state);
 int lua_Control_createAnimationFromBy(lua_State* state);
 int lua_Control_createAnimationFromTo(lua_State* state);
 int lua_Control_destroyAnimation(lua_State* state);
+int lua_Control_getAbsoluteBounds(lua_State* state);
 int lua_Control_getAlignment(lua_State* state);
 int lua_Control_getAnimation(lua_State* state);
 int lua_Control_getAnimationPropertyComponentCount(lua_State* state);

+ 45 - 41
gameplay/src/lua/lua_Form.cpp

@@ -50,6 +50,7 @@ void luaRegister_Form()
         {"createAnimationFromTo", lua_Form_createAnimationFromTo},
         {"destroyAnimation", lua_Form_destroyAnimation},
         {"draw", lua_Form_draw},
+        {"getAbsoluteBounds", lua_Form_getAbsoluteBounds},
         {"getAlignment", lua_Form_getAlignment},
         {"getAnimation", lua_Form_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Form_getAnimationPropertyComponentCount},
@@ -136,7 +137,6 @@ void luaRegister_Form()
         {"setVisible", lua_Form_setVisible},
         {"setWidth", lua_Form_setWidth},
         {"setZIndex", lua_Form_setZIndex},
-        {"timeEvent", lua_Form_timeEvent},
         {"update", lua_Form_update},
         {NULL, NULL}
     };
@@ -788,6 +788,50 @@ int lua_Form_draw(lua_State* state)
     return 0;
 }
 
+int lua_Form_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Form* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Form_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_getAlignment(lua_State* state)
 {
     // Get the number of parameters.
@@ -5204,46 +5248,6 @@ int lua_Form_static_getForm(lua_State* state)
     return 0;
 }
 
-int lua_Form_timeEvent(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_TNONE)
-            {
-                // Get parameter 1 off the stack.
-                long param1 = (long)luaL_checklong(state, 2);
-
-                // Get parameter 2 off the stack.
-                void* param2 = (void*)luaL_checkint(state, 3);
-
-                Form* instance = getInstance(state);
-                instance->timeEvent(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Form_timeEvent - 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_Form_update(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -15,6 +15,7 @@ int lua_Form_createAnimationFromBy(lua_State* state);
 int lua_Form_createAnimationFromTo(lua_State* state);
 int lua_Form_destroyAnimation(lua_State* state);
 int lua_Form_draw(lua_State* state);
+int lua_Form_getAbsoluteBounds(lua_State* state);
 int lua_Form_getAlignment(lua_State* state);
 int lua_Form_getAnimation(lua_State* state);
 int lua_Form_getAnimationPropertyComponentCount(lua_State* state);
@@ -111,7 +112,6 @@ int lua_Form_static_ANIMATE_SIZE_HEIGHT(lua_State* state);
 int lua_Form_static_ANIMATE_SIZE_WIDTH(lua_State* state);
 int lua_Form_static_create(lua_State* state);
 int lua_Form_static_getForm(lua_State* state);
-int lua_Form_timeEvent(lua_State* state);
 int lua_Form_update(lua_State* state);
 
 void luaRegister_Form();

+ 45 - 0
gameplay/src/lua/lua_ImageControl.cpp

@@ -31,6 +31,7 @@ void luaRegister_ImageControl()
         {"createAnimationFromBy", lua_ImageControl_createAnimationFromBy},
         {"createAnimationFromTo", lua_ImageControl_createAnimationFromTo},
         {"destroyAnimation", lua_ImageControl_destroyAnimation},
+        {"getAbsoluteBounds", lua_ImageControl_getAbsoluteBounds},
         {"getAlignment", lua_ImageControl_getAlignment},
         {"getAnimation", lua_ImageControl_getAnimation},
         {"getAnimationPropertyComponentCount", lua_ImageControl_getAnimationPropertyComponentCount},
@@ -682,6 +683,50 @@ int lua_ImageControl_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_ImageControl_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                ImageControl* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_ImageControl_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_ImageControl_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_ImageControl_createAnimation(lua_State* state);
 int lua_ImageControl_createAnimationFromBy(lua_State* state);
 int lua_ImageControl_createAnimationFromTo(lua_State* state);
 int lua_ImageControl_destroyAnimation(lua_State* state);
+int lua_ImageControl_getAbsoluteBounds(lua_State* state);
 int lua_ImageControl_getAlignment(lua_State* state);
 int lua_ImageControl_getAnimation(lua_State* state);
 int lua_ImageControl_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -31,6 +31,7 @@ void luaRegister_Joystick()
         {"createAnimationFromBy", lua_Joystick_createAnimationFromBy},
         {"createAnimationFromTo", lua_Joystick_createAnimationFromTo},
         {"destroyAnimation", lua_Joystick_destroyAnimation},
+        {"getAbsoluteBounds", lua_Joystick_getAbsoluteBounds},
         {"getAlignment", lua_Joystick_getAlignment},
         {"getAnimation", lua_Joystick_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Joystick_getAnimationPropertyComponentCount},
@@ -685,6 +686,50 @@ int lua_Joystick_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Joystick* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Joystick_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_Joystick_createAnimation(lua_State* state);
 int lua_Joystick_createAnimationFromBy(lua_State* state);
 int lua_Joystick_createAnimationFromTo(lua_State* state);
 int lua_Joystick_destroyAnimation(lua_State* state);
+int lua_Joystick_getAbsoluteBounds(lua_State* state);
 int lua_Joystick_getAlignment(lua_State* state);
 int lua_Joystick_getAnimation(lua_State* state);
 int lua_Joystick_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -31,6 +31,7 @@ void luaRegister_Label()
         {"createAnimationFromBy", lua_Label_createAnimationFromBy},
         {"createAnimationFromTo", lua_Label_createAnimationFromTo},
         {"destroyAnimation", lua_Label_destroyAnimation},
+        {"getAbsoluteBounds", lua_Label_getAbsoluteBounds},
         {"getAlignment", lua_Label_getAlignment},
         {"getAnimation", lua_Label_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Label_getAnimationPropertyComponentCount},
@@ -679,6 +680,50 @@ int lua_Label_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Label_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Label* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Label_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_Label_createAnimation(lua_State* state);
 int lua_Label_createAnimationFromBy(lua_State* state);
 int lua_Label_createAnimationFromTo(lua_State* state);
 int lua_Label_destroyAnimation(lua_State* state);
+int lua_Label_getAbsoluteBounds(lua_State* state);
 int lua_Label_getAlignment(lua_State* state);
 int lua_Label_getAnimation(lua_State* state);
 int lua_Label_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -34,6 +34,7 @@ void luaRegister_RadioButton()
         {"createAnimationFromBy", lua_RadioButton_createAnimationFromBy},
         {"createAnimationFromTo", lua_RadioButton_createAnimationFromTo},
         {"destroyAnimation", lua_RadioButton_destroyAnimation},
+        {"getAbsoluteBounds", lua_RadioButton_getAbsoluteBounds},
         {"getAlignment", lua_RadioButton_getAlignment},
         {"getAnimation", lua_RadioButton_getAnimation},
         {"getAnimationPropertyComponentCount", lua_RadioButton_getAnimationPropertyComponentCount},
@@ -688,6 +689,50 @@ int lua_RadioButton_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                RadioButton* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_RadioButton_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_RadioButton_createAnimation(lua_State* state);
 int lua_RadioButton_createAnimationFromBy(lua_State* state);
 int lua_RadioButton_createAnimationFromTo(lua_State* state);
 int lua_RadioButton_destroyAnimation(lua_State* state);
+int lua_RadioButton_getAbsoluteBounds(lua_State* state);
 int lua_RadioButton_getAlignment(lua_State* state);
 int lua_RadioButton_getAnimation(lua_State* state);
 int lua_RadioButton_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -32,6 +32,7 @@ void luaRegister_Slider()
         {"createAnimationFromBy", lua_Slider_createAnimationFromBy},
         {"createAnimationFromTo", lua_Slider_createAnimationFromTo},
         {"destroyAnimation", lua_Slider_destroyAnimation},
+        {"getAbsoluteBounds", lua_Slider_getAbsoluteBounds},
         {"getAlignment", lua_Slider_getAlignment},
         {"getAnimation", lua_Slider_getAnimation},
         {"getAnimationPropertyComponentCount", lua_Slider_getAnimationPropertyComponentCount},
@@ -694,6 +695,50 @@ int lua_Slider_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_Slider_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                Slider* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Slider_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_Slider_createAnimation(lua_State* state);
 int lua_Slider_createAnimationFromBy(lua_State* state);
 int lua_Slider_createAnimationFromTo(lua_State* state);
 int lua_Slider_destroyAnimation(lua_State* state);
+int lua_Slider_getAbsoluteBounds(lua_State* state);
 int lua_Slider_getAlignment(lua_State* state);
 int lua_Slider_getAnimation(lua_State* state);
 int lua_Slider_getAnimationPropertyComponentCount(lua_State* state);

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

@@ -32,6 +32,7 @@ void luaRegister_TextBox()
         {"createAnimationFromBy", lua_TextBox_createAnimationFromBy},
         {"createAnimationFromTo", lua_TextBox_createAnimationFromTo},
         {"destroyAnimation", lua_TextBox_destroyAnimation},
+        {"getAbsoluteBounds", lua_TextBox_getAbsoluteBounds},
         {"getAlignment", lua_TextBox_getAlignment},
         {"getAnimation", lua_TextBox_getAnimation},
         {"getAnimationPropertyComponentCount", lua_TextBox_getAnimationPropertyComponentCount},
@@ -681,6 +682,50 @@ int lua_TextBox_destroyAnimation(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_getAbsoluteBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                TextBox* instance = getInstance(state);
+                void* returnPtr = (void*)&(instance->getAbsoluteBounds());
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Rectangle");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_TextBox_getAbsoluteBounds - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_getAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -13,6 +13,7 @@ int lua_TextBox_createAnimation(lua_State* state);
 int lua_TextBox_createAnimationFromBy(lua_State* state);
 int lua_TextBox_createAnimationFromTo(lua_State* state);
 int lua_TextBox_destroyAnimation(lua_State* state);
+int lua_TextBox_getAbsoluteBounds(lua_State* state);
 int lua_TextBox_getAlignment(lua_State* state);
 int lua_TextBox_getAnimation(lua_State* state);
 int lua_TextBox_getAnimationPropertyComponentCount(lua_State* state);