Explorar el Código

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

sgrenier hace 13 años
padre
commit
701df8c4f5

+ 1 - 1
gameplay/gameplay.vcxproj

@@ -922,7 +922,7 @@
       </PrecompiledHeader>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>USE_XINPUT;_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>

+ 4 - 7
gameplay/src/Game.cpp

@@ -183,14 +183,11 @@ void Game::shutdown()
 		}
 		_scriptController->finalize();
 
-        std::vector<Gamepad*>* gamepads = Gamepad::getGamepads();
-        if (gamepads)
+        unsigned int gamepadCount = Gamepad::getGamepadCount();
+        for (unsigned int i = 0; i < gamepadCount; i++)
         {
-            for (size_t i = 0, count = gamepads->size(); i < count; ++i)
-            {
-                SAFE_DELETE((*gamepads)[i]);
-            }
-            gamepads->clear();
+            Gamepad* gamepad = Gamepad::getGamepad(i);
+            SAFE_DELETE(gamepad);
         }
 
         _animationController->finalize();

+ 19 - 0
gameplay/src/Game.h

@@ -440,6 +440,25 @@ public:
      */
     virtual void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
 
+    /**
+     * Gets the current number of gamepads currently connected to the system.
+     *
+     * @return The number of gamepads currently connected to the system.
+     */
+    inline unsigned int getGamepadCount() const;
+
+    /**
+     * Gets the gamepad at the specified index. 
+     *
+     * The gamepad index can change when connnected and disconnected so you
+     * cannot relie on this other than iterating through them all to display
+     * them or poll them.
+     *
+     * @param index The index of the gamepad to retrieve.
+     * @return The gamepad at the specified index.
+     */
+    inline Gamepad* getGamepad(unsigned int index) const;
+
     /**
      * Sets multi-touch is to be enabled/disabled. Default is disabled.
      *

+ 10 - 0
gameplay/src/Game.inl

@@ -116,6 +116,16 @@ inline void Game::getAccelerometerValues(float* pitch, float* roll)
     Platform::getAccelerometerValues(pitch, roll);
 }
 
+inline unsigned int Game::getGamepadCount() const
+{
+    return Gamepad::getGamepadCount();
+}
+
+inline Gamepad* Game::getGamepad(unsigned int index) const
+{
+    return Gamepad::getGamepad(index);
+}
+
 inline void Game::displayKeyboard(bool display)
 {
     Platform::displayKeyboard(display);

+ 13 - 28
gameplay/src/Gamepad.cpp

@@ -9,13 +9,12 @@ namespace gameplay
 static std::vector<Gamepad*> __gamepads;
 
 Gamepad::Gamepad(const char* formPath)
-    : _id(""), _handle(0), _vendorId(0), _productId(0), _buttonCount(0), _joystickCount(0), _triggerCount(0), _form(NULL)
+    : _handle(0), _vendorId(0), _productId(0), _buttonCount(0), _joystickCount(0), _triggerCount(0), _form(NULL), _buttons(0)
 {
     GP_ASSERT(formPath);
     _form = Form::create(formPath);
     GP_ASSERT(_form);
     _form->setConsumeInputEvents(false);
-    _id = _form->getId();
     _vendorString = "None";
     _productString = "Virtual";
 
@@ -32,10 +31,10 @@ Gamepad::Gamepad(const char* formPath)
     bindGamepadControls(_form);
 }
 
-Gamepad::Gamepad(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+Gamepad::Gamepad(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
                  unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
-    : _id(id), _handle(handle), _vendorId(vendorId), _productId(productId), _vendorString(vendorString), _productString(productString),
-      _buttonCount(buttonCount), _joystickCount(joystickCount), _triggerCount(triggerCount), _form(NULL)
+    : _handle(handle), _vendorId(vendorId), _productId(productId), _vendorString(vendorString), _productString(productString),
+      _buttonCount(buttonCount), _joystickCount(joystickCount), _triggerCount(triggerCount), _form(NULL), _buttons(0)
 {
 }
 
@@ -47,10 +46,11 @@ Gamepad::~Gamepad()
     }
 }
 
-Gamepad* Gamepad::add(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
-    unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
+Gamepad* Gamepad::add(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                      unsigned int vendorId, unsigned int productId, 
+                      const char* vendorString, const char* productString)
 {
-    Gamepad* gamepad = new Gamepad(id, handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+    Gamepad* gamepad = new Gamepad(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
 
     __gamepads.push_back(gamepad);
     Game::getInstance()->gamepadEvent(CONNECTED_EVENT, gamepad);
@@ -129,28 +129,18 @@ void Gamepad::bindGamepadControls(Container* container)
             Button* button = (Button*)control;
             _uiButtons[button->getDataBinding()] = button;
             _buttonCount++;
-        }   
+        }
     }
 }
 
-Gamepad* Gamepad::getGamepad(GamepadHandle handle)
+unsigned int Gamepad::getGamepadCount()
 {
-    std::vector<Gamepad*>::const_iterator it;
-    for (it = __gamepads.begin(); it != __gamepads.end(); it++)
-    {
-        Gamepad* gamepad = *it;
-        if (!gamepad->isVirtual() && gamepad->_handle == handle)
-        {
-            return gamepad;
-        }
-    }
-
-    return NULL;
+    return __gamepads.size();
 }
 
-std::vector<Gamepad*>* Gamepad::getGamepads()
+Gamepad* Gamepad::getGamepad(unsigned int index)
 {
-    return &__gamepads;
+    return __gamepads[index];
 }
 
 Gamepad::ButtonMapping Gamepad::getButtonMappingFromString(const char* string)
@@ -200,11 +190,6 @@ Gamepad::ButtonMapping Gamepad::getButtonMappingFromString(const char* string)
     return BUTTON_A;
 }
 
-const char* Gamepad::getId() const
-{
-    return _id.c_str();
-}
-
 const unsigned int Gamepad::getVendorId() const
 {
     return _vendorId;

+ 46 - 59
gameplay/src/Gamepad.h

@@ -58,48 +58,6 @@ public:
         BUTTON_RIGHT
     };
 
-    /**
-     * Get all connected gamepads.
-     *
-     * @return A vector of all connected gamepads.
-     */
-    static std::vector<Gamepad*>* getGamepads();
-
-    /**
-     * Get this gamepad's ID as a string.
-     *
-     * @return This gamepad's ID as a string.
-     */
-    const char* getId() const;
-
-    /**
-     * Get this gamepad's vendor ID.
-     *
-     * @return This gamepad's vendor ID.
-     */
-    const unsigned int getVendorId() const;
-
-    /**
-     * Get this gamepad's product ID.
-     *
-     * @return This gamepad's product ID.
-     */
-    const unsigned int getProductId() const;
-
-    /**
-     * Get this gamepad's vendor name.
-     *
-     * @return This gamepad's vendor name.
-     */
-    const char* getVendorString() const;
-
-    /**
-     * Get this gamepad's product name.
-     *
-     * @return This gamepad's product name.
-     */
-    const char* getProductString() const;
-
     /**
      * Gets the number of buttons on this gamepad.
      *
@@ -148,6 +106,34 @@ public:
      */
     float getTriggerValue(unsigned int triggerId) const;
 
+   /**
+     * Get this gamepad's vendor ID.
+     *
+     * @return This gamepad's vendor ID.
+     */
+    const unsigned int getVendorId() const;
+
+    /**
+     * Get this gamepad's product ID.
+     *
+     * @return This gamepad's product ID.
+     */
+    const unsigned int getProductId() const;
+
+    /**
+     * Get this gamepad's vendor name.
+     *
+     * @return This gamepad's vendor name.
+     */
+    const char* getVendorString() const;
+
+    /**
+     * Get this gamepad's product name.
+     *
+     * @return This gamepad's product name.
+     */
+    const char* getProductString() const;
+
     /**
      * Returns whether the gamepad is currently represented with a UI form or not.
      *
@@ -191,36 +177,39 @@ private:
     /**
      * Constructs a physical gamepad.
      *
-     * @param id The gamepad's id.
      * @param handle The gamepad handle
      * @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.
+     * @param vendorId The vendor id
+     * @param productId The product id
+     * @param vendorString The vendor string/name.
+     * @param productString The product string/name.
      */
-    Gamepad(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
-            unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString);
+    Gamepad(GamepadHandle handle, 
+            unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+            unsigned int vendorId, unsigned int productId, 
+            const char* vendorString, const char* productString);
 
     /**
      * Copy constructor.
      */
     Gamepad(const Gamepad& copy);
 
-    /**
-     * Used by platforms to add gamepads to the set available to games.
-     */
-    static Gamepad* add(const char* id, GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
-                        unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString);
+    static Gamepad* add(GamepadHandle handle, 
+                        unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                        unsigned int vendorId, unsigned int productId, 
+                        const char* vendorString, const char* productString);
 
-    /**
-     * Used by Game::loadGamepads() to add virtual gamepads from a game's config file.
-     */
     static Gamepad* add(const char* formPath);
 
     static void remove(GamepadHandle handle);
 
     static void remove(Gamepad* gamepad);
 
-    static Gamepad* getGamepad(GamepadHandle handle);
+    static unsigned int getGamepadCount();
+
+    static Gamepad* getGamepad(unsigned int index);
 
     static ButtonMapping getButtonMappingFromString(const char* string);
 
@@ -236,16 +225,14 @@ private:
 
     static unsigned int getIndexFromMapping(Gamepad::ButtonMapping mapping);
 
-    std::string _id;
     GamepadHandle _handle;        // The handle of the Gamepad.
+    unsigned int _buttonCount;    // Number of buttons.
+    unsigned int _joystickCount;  // Number of joysticks.
+    unsigned int _triggerCount;   // Number of triggers.
     unsigned int _vendorId;
     unsigned int _productId;
     std::string _vendorString;
     std::string _productString;
-
-    unsigned int _buttonCount;    // Number of buttons.
-    unsigned int _joystickCount;  // Number of joysticks.
-    unsigned int _triggerCount;   // Number of triggers.
     
     // Data needed for virtual gamepads.
     Form* _form;

+ 48 - 50
gameplay/src/Platform.h

@@ -14,12 +14,19 @@ namespace gameplay
 class Game;
 
 /**
- * Defines a platform.
+ * Defines a platform abstraction.
+ * 
+ * This class has only a few public methods for creating a platform 
+ *
  */
 class Platform
 {
 public:
 
+    friend class Game;
+    friend class Gamepad;
+    friend class ScreenDisplayer;
+
     /**
      * Destructor.
      */
@@ -48,6 +55,8 @@ public:
      * @return The platform message pump return code.
      */
     int enterMessagePump();
+
+private:
     
     /**
      * This method informs the platform that the game is shutting down 
@@ -230,74 +239,63 @@ public:
     static void pollGamepadState(Gamepad* gamepad);
 
     /**
-     * Touch callback on touch events. This method handles passing the touch event to the form or to the game.
+     * Opens an URL in an external browser, if available.
      *
-     * @param evt The touch event that occurred.
-     * @param x The x position of the touch in pixels. Left edge is zero.
-     * @param y The y position of the touch in pixels. Top edge is zero.
-     * @param contactIndex An integer to identify this contact point within the currently active touch set.
+     * @param url URL to be opened.
      *
-     * @see Touch::TouchEvent
+     * @return True if URL was opened successfully, false otherwise.
      */
-    static void touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
+    static bool launchURL(const char* url);
 
     /**
-     * Keyboard callback on keyPress events.
-     *
-     * @param evt The key event that occurred.
-     * @param key If evt is KEY_PRESS or KEY_RELEASE then key is the key code from Keyboard::Key.
-     *            If evt is KEY_CHAR then key is the unicode value of the character.
-     * 
-     * @see Keyboard::KeyEvent
-     * @see Keyboard::Key
+     * Constructor.
      */
-    static void keyEventInternal(Keyboard::KeyEvent evt, int key);
+    Platform(Game* game);
 
     /**
-     * Mouse callback on mouse events. If the game does not consume the mouse move event or left mouse click event
-     * then it is interpreted as a touch event instead.
-     *
-     * @param evt The mouse event that occurred.
-     * @param x The x position of the mouse in pixels. Left edge is zero.
-     * @param y The y position of the mouse in pixels. Top edge is zero.
-     * @param wheelDelta The number of mouse wheel ticks. Positive is up (forward), negative is down (backward).
-     *
-     * @return True if the mouse event is consumed or false if it is not consumed.
-     *
-     * @see Mouse::MouseEvent
+     * Constructor.
      */
-    static bool mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
+    Platform(const Platform& copy);
 
-    /**
-     * Gamepad callback on gamepad events. This is called only from platform when gamepad are connectd and disconnected.
-     *
-     * @param evt The mouse event that occurred.
-     * @param gamepad The gamepad that is either connected or disconnected from the platform.
+public:
+
+   /**
+     * Internal method used only from static code in various platform implementation.
      *
-     * @see Gamepad::GamepadEvent
+     * @script{ignore}
      */
-    static void gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad);
+    static void touchEventInternal(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
 
-    /**
-     * Opens an URL in an external browser, if available.
-     *
-     * @param url URL to be opened.
+   /**
+     * Internal method used only from static code in various platform implementation.
      *
-     * @return True if URL was opened successfully, false otherwise.
+     * @script{ignore}
      */
-    static bool launchURL(const char* url);
-    
-private:
+    static void keyEventInternal(Keyboard::KeyEvent evt, int key);
 
-    /**
-     * Constructor.
+   /**
+     * Internal method used only from static code in various platform implementation.
+     *
+     * @script{ignore}
      */
-    Platform(Game* game);
+    static bool mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
 
-    /**
-     * Constructor.
+   /**
+     * Internal method used only from static code in various platform implementation.
+     *
+     * @script{ignore}
      */
-    Platform(const Platform& copy);
+    static void gamepadEventConnectedInternal(GamepadHandle handle, unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                              unsigned int vendorId, unsigned int productId, 
+                                              const char* vendorString, const char* productString);
+   /**
+     * Internal method used only from static code in various platform implementation.
+     *
+     * @script{ignore}
+     */
+    static void gamepadEventDisconnectedInternal(GamepadHandle handle);
+
+private:
 
     Game* _game;                // The game this platform is interfacing with.
 };

+ 8 - 1
gameplay/src/PlatformAndroid.cpp

@@ -1252,8 +1252,15 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
 {
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
+
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
+{
+    Gamepad::remove(handle);
 }
 
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)

+ 21 - 30
gameplay/src/PlatformBlackBerry.cpp

@@ -521,8 +521,9 @@ static const int __PIDs[] = {
 
 static const unsigned int __knownGamepads = 3;
 
-void loadGamepad(GamepadHandle handle, int* buttonCount, int* joystickCount, int* productId, int* vendorId, char* id, char* productString, char* vendorString)
+void queryGamepad(GamepadHandle handle, int* buttonCount, int* joystickCount, int* productId, int* vendorId, char* productString, char* vendorString)
 {
+    char id[128];
     screen_get_device_property_iv(handle, SCREEN_PROPERTY_BUTTON_COUNT, buttonCount);
     screen_get_device_property_cv(handle, SCREEN_PROPERTY_ID_STRING, 128, id);
     screen_get_device_property_cv(handle, SCREEN_PROPERTY_PRODUCT, 64, productString);
@@ -626,10 +627,6 @@ void Platform::pollGamepadState(Gamepad* gamepad)
         gamepad->_triggers[i] = value;
     }
 }
-#else
-void Platform::getGamepadButtonValues(GamepadHandle handle, unsigned int* out) { }
-void Platform::getGamepadJoystickValues(GamepadHandle handle, unsigned int joystickIndex, Vector2* outValue) { }
-void Platform::getGamepadTriggerValue(GamepadHandle handle, unsigned int triggerIndex, float* out) { }
 #endif
 
 Platform::Platform(Game* game)
@@ -975,13 +972,15 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         glIsVertexArray = (PFNGLISVERTEXARRAYOESPROC)eglGetProcAddress("glIsVertexArrayOES");
     }
 
-    // Discover gamepad devices.
+ #ifdef BLACKBERRY_USE_GAMEPAD
+    // Discover initial gamepad devices.
     int count;
     screen_get_context_property_iv(__screenContext, SCREEN_PROPERTY_DEVICE_COUNT, &count);
     screenDevs = (screen_device_t*)calloc(count, sizeof(screen_device_t));
     screen_get_context_property_pv(__screenContext, SCREEN_PROPERTY_DEVICES, (void**)screenDevs);
 
-	for (int i = 0; i < count; i++) {
+	for (int i = 0; i < count; i++) 
+    {
 	    int type;
         screen_get_device_property_iv(screenDevs[i], SCREEN_PROPERTY_TYPE, &type);
 
@@ -991,21 +990,19 @@ Platform* Platform::create(Game* game, void* attachToWindow)
             int joystickCount = 0;
             int productId;
             int vendorId;
-            char id[128];
             char productString[64];
             char vendorString[64];
-            loadGamepad(screenDevs[i], &buttonCount, &joystickCount, &productId, &vendorId, id, productString, vendorString);
-            Gamepad::add(id, screenDevs[i], buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+            queryGamepad(screenDevs[i], &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
+            Platform::gamepadEventConnectedInternal(screenDevs[i], buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
         }
 	}
 	free(screenDevs);
+#endif
 
     return platform;
 
 error:
 
-    // TODO: cleanup
-
     return NULL;
 }
 
@@ -1223,7 +1220,7 @@ int Platform::enterMessagePump()
                         }
                         break;
                     }
-#ifdef __BB10__
+#ifdef BLACKBERRY_USE_GAMEPAD
                     case SCREEN_EVENT_DEVICE:
                     {
                         // A device was attached or removed.
@@ -1243,16 +1240,15 @@ int Platform::enterMessagePump()
                                 int joystickCount = 0;
                                 int productId;
                                 int vendorId;
-                                char id[128];
                                 char productString[64];
                                 char vendorString[64];
-                                loadGamepad(device, &buttonCount, &joystickCount, &productId, &vendorId, id, productString, vendorString);
-                                Gamepad::add(id, device, buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
+                                queryGamepad(device, &buttonCount, &joystickCount, &productId, &vendorId, productString, vendorString);
+                                Platform::gamepadEventConnectedInternal(device, buttonCount, joystickCount, 0, vendorId, productId, vendorString, productString);
                             }
                         }
                         else
                         {
-                            Gamepad::remove(device);
+                            Platform::gamepadEventDisconnectedInternal(device);
                         }
 
                         break;
@@ -1521,20 +1517,15 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
 {
-    if (evt == Gamepad::CONNECTED_EVENT)
-    {
-        Gamepad::add(gamepad->_id.c_str(), 
-                     gamepad->_handle, 
-                     gamepad->_buttonCount, gamepad->_joystickCount, gamepad->_triggerCount,
-                     gamepad->_vendorId, gamepad->_productId, 
-                     gamepad->_vendorString.c_str(), gamepad->_productString.c_str());
-    }
-    else if (evt == Gamepad::DISCONNECTED_EVENT) 
-    {
-        Gamepad::remove(gamepad);
-    }
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
+
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
+{
+    Gamepad::remove(handle);
 }
 
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)

+ 9 - 2
gameplay/src/PlatformLinux.cpp

@@ -1119,8 +1119,15 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
-{
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
+{
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
+
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
+{
+    Gamepad::remove(handle);
 }
 
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)

+ 125 - 28
gameplay/src/PlatformMacOSX.mm

@@ -404,7 +404,7 @@ double getMachTimeInMilliseconds()
             [[self buttons] addObject:button];
         }
     }
-    // Go back and get proprietary information (e.g. triggers) and asscoaite with appropriate values
+    // Go back and get proprietary information (e.g. triggers) and associate with appropriate values
     // Example for other trigger buttons
     uint32_t vendorID = [self vendorID];
     uint32_t productID = [self productID];
@@ -420,28 +420,29 @@ double getMachTimeInMilliseconds()
         {
             if((unsigned long)cookie == 39)
             {
-                OSXGamepadButton *leftTrigger = [self buttonWithCookie:(IOHIDElementCookie)9];
-                if(leftTrigger)
+                OSXGamepadButton *leftTriggerButton = [self buttonWithCookie:(IOHIDElementCookie)9];
+                if(leftTriggerButton)
                 {
-                    [leftTrigger setTriggerElement:hidElement];
-                    [[self triggerButtons] addObject:leftTrigger];
-                    //[[self buttons] removeObject:leftTrigger]; Defer to gamepad team on this line..  not sure how they intend to tackle
+                    [leftTriggerButton setTriggerElement:hidElement];
+                    [[self triggerButtons] addObject:leftTriggerButton];
+                    [[self buttons] removeObject:leftTriggerButton]; // Defer to gamepad team on this line..  not sure how they intend to tackle
                 }
             }
             if((unsigned long)cookie == 40)
             {
-                OSXGamepadButton *rightTrigger = [self buttonWithCookie:(IOHIDElementCookie)10];
-                if(rightTrigger)
+                OSXGamepadButton *rightTriggerButton = [self buttonWithCookie:(IOHIDElementCookie)10];
+                if(rightTriggerButton)
                 {
-                    [rightTrigger setTriggerElement:hidElement];
-                    [[self triggerButtons] addObject:rightTrigger];
-                    //[[self buttons] removeObject:rightTrigger];
+                    [rightTriggerButton setTriggerElement:hidElement];
+                    [[self triggerButtons] addObject:rightTriggerButton];
+                    [[self buttons] removeObject:rightTriggerButton];
                 }
             }
         }
     }
     
 }
+
 - (OSXGamepadButton*)buttonWithCookie:(IOHIDElementCookie)cookie {
     for(OSXGamepadButton *b in [self buttons]) {
         if([b cookie] == cookie) return b;
@@ -466,6 +467,7 @@ double getMachTimeInMilliseconds()
         IOHIDElementRef hidElement = (IOHIDElementRef)CFArrayGetValueAtIndex(elements, i);
         IOHIDQueueAddElement([self queueRef], hidElement);
     }
+    
     IOHIDQueueScheduleWithRunLoop([self queueRef], CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
     
     return true;
@@ -578,6 +580,10 @@ double getMachTimeInMilliseconds()
     {
         [r addObject:(id)[a element]];
     }
+    for(OSXGamepadButton* t in [self triggerButtons])
+    {
+        [r addObject:(id)[t element]];
+    }
     return [NSArray arrayWithArray:r];
 }
 - (void)hidValueAvailable:(IOHIDValueRef)value
@@ -620,6 +626,8 @@ double getMachTimeInMilliseconds()
 @end
 
 
+
+
 @interface View : NSOpenGLView <NSWindowDelegate>
 {
 @public
@@ -628,8 +636,10 @@ double getMachTimeInMilliseconds()
 
 @protected
     Game* _game;
-    unsigned int _gestureEvents;    
-}
+    unsigned int _gestureEvents;
+}    
+- (void) detectGamepads: (Game*) game;
+
 @end
 
 
@@ -654,6 +664,43 @@ double getMachTimeInMilliseconds()
     return kCVReturnSuccess;
 }
 
+- (void) detectGamepads: (Game*) game
+{
+    // Locate any newly connected devices
+    for(OSXGamepad* gamepad in __gamepads)
+    {
+        NSNumber* locationID = [gamepad locationID];
+        if([__activeGamepads objectForKey:locationID] == NULL)
+        {            
+            // Gameplay::add is friended to Platform, but we're not in Platform right now.
+            Platform::gamepadEventConnectedInternal((unsigned int)[locationID intValue],
+                                                    [gamepad numberOfButtons],
+                                                    [gamepad numberOfSticks],
+                                                    0, //[gamepad numberOfTriggerButtons], PS3 triggers are not working yet
+                                                    [gamepad vendorID],
+                                                    [gamepad productID],
+                                                    [[gamepad manufacturerName] cStringUsingEncoding:NSASCIIStringEncoding],
+                                                    [[gamepad productName] cStringUsingEncoding:NSASCIIStringEncoding]);
+
+            [__activeGamepads setObject:locationID forKey:locationID];
+        }
+    }
+    
+    // Detect any disconnected gamepads
+    NSMutableArray* deadGamepads = [NSMutableArray array];
+    for(NSNumber* locationID in __activeGamepads)
+    {
+        OSXGamepad* gamepad = gamepadForLocationID(locationID);
+        if(gamepad == NULL)
+        {
+            NSNumber* gameHandle = [__activeGamepads objectForKey:locationID];
+            Platform::gamepadEventDisconnectedInternal((unsigned int)[locationID intValue]);
+            [deadGamepads addObject:locationID];
+        }
+    }
+    [__activeGamepads removeObjectsForKeys:deadGamepads];
+}
+
 -(void) update
 {       
     [gameLock lock];
@@ -662,6 +709,8 @@ double getMachTimeInMilliseconds()
     CGLLockContext((CGLContextObj)[[self openGLContext] CGLContextObj]);
     if (_game)
     {
+        [self detectGamepads: _game];
+        
         _game->frame();
     }
     CGLFlushDrawable((CGLContextObj)[[self openGLContext] CGLContextObj]);
@@ -882,7 +931,7 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
 - (void) mouseDragged: (NSEvent*) event
 {
     NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
-    if (__leftMouseDown && !__mouseCaptured)
+    if (__leftMouseDown)
     {
         [self mouse: Mouse::MOUSE_MOVE orTouchEvent: Touch::TOUCH_MOVE x: point.x y: __height - point.y s: 0];
     }
@@ -1715,21 +1764,16 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     
     return result;
 }
+    
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
+{
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
 {
-    if (evt == Gamepad::CONNECTED_EVENT)
-    {
-        Gamepad::add(gamepad->_id.c_str(), 
-                     gamepad->_handle, 
-                     gamepad->_buttonCount, gamepad->_joystickCount, gamepad->_triggerCount,
-                     gamepad->_vendorId, gamepad->_productId, 
-                     gamepad->_vendorString.c_str(), gamepad->_productString.c_str());
-    }
-    else if (evt == Gamepad::DISCONNECTED_EVENT) 
-    {
-        Gamepad::remove(gamepad);
-    }
+    Gamepad::remove(handle);
 }
 
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)
@@ -1766,10 +1810,63 @@ bool Platform::isGestureRegistered(Gesture::GestureEvent evt)
 
 void Platform::pollGamepadState(Gamepad* gamepad)
 {
-}
+    OSXGamepad* gp = gamepadForGameHandle(gamepad->_handle);
+    
+    if (gp)
+    {
+        static const unsigned int PS3Mapping[17] = {
+            Gamepad::BUTTON_MENU1,  // 0x0001
+            Gamepad::BUTTON_L3,     // 0x0002
+            Gamepad::BUTTON_R3,     // 0x0004
+            Gamepad::BUTTON_MENU2,  // 0x0008
+            Gamepad::BUTTON_UP,     // 0x0010
+            Gamepad::BUTTON_RIGHT,  // 0x0020
+            Gamepad::BUTTON_DOWN,   // 0x0040
+            Gamepad::BUTTON_LEFT,   // 0x0080
+            Gamepad::BUTTON_L2,     // 0x0100
+            Gamepad::BUTTON_R2,     // 0x0200
+            Gamepad::BUTTON_L1,     // 0x0400
+            Gamepad::BUTTON_R1,     // 0x0800
+            Gamepad::BUTTON_Y,      // 0x1000
+            Gamepad::BUTTON_B,      // 0x2000
+            Gamepad::BUTTON_A,      // 0x4000
+            Gamepad::BUTTON_X,      // 0x8000
+            Gamepad::BUTTON_MENU3   // 0x10000
+        };
+        
+        const unsigned int* mapping = NULL;
+        if (gamepad->_vendorId == SONY_USB_VENDOR_ID &&
+            gamepad->_productId == SONY_USB_PS3_PRODUCT_ID)
+        {
+            mapping = PS3Mapping;
+        }
+        
+        gamepad->_buttons = 0;
+        //for (OSXGamepadButton *b in [gp buttons])
+        for (int i = 0; i < [gp numberOfButtons]; ++i)
+        {
+            OSXGamepadButton* b = [gp buttonAtIndex: i];
+            if ([b state])
+            {
+                // This button is down.
+                gamepad->_buttons |= (1 << mapping[i]);
+            }
+        }
 
+        for (unsigned int i = 0; i < [gp numberOfSticks]; ++i)
+        {
+            gamepad->_joysticks[i].x = [[gp axisAtIndex: i*2] calibratedValue];
+            gamepad->_joysticks[i].y = [[gp axisAtIndex: i*2 + 1] calibratedValue];
+        }
+        
+        for (unsigned int i = 0; i < [gp numberOfTriggerButtons]; ++i)
+        {
+            gamepad->_triggers[i] = [[gp triggerButtonAtIndex: i] calibratedStateValue];
+        }
+    }
 }
 
+}
 
 OSXGamepad* gamepadForLocationID(NSNumber* locationID)
 {

+ 21 - 12
gameplay/src/PlatformWindows.cpp

@@ -47,6 +47,7 @@ static const unsigned int XINPUT_TRIGGER_COUNT = 2;
 
 #ifdef USE_XINPUT
 static XINPUT_STATE __xInputState;
+static bool __connectedXInput[4];
 
 static float normalizeXInputJoystickAxis(int axisValue, int deadZone)
 {
@@ -910,11 +911,13 @@ Platform* Platform::create(Game* game, void* attachToWindow)
     {
         if (XInputGetState(i, &__xInputState) == NO_ERROR)
         {
-            // Gamepad is connected.
-            char id[9];
-            sprintf(id, "XInput %d", i);
-            Gamepad::add(id, i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT,
-                         0, 0, "Unknown", "XInput Gamepad");
+            if (!__connectedXInput[i])
+            {
+                // Gamepad is connected.
+                Platform::gamepadEventConnectedInternal(i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT, 0, 0, "Microsoft", "XBox360 Controller");
+                __connectedXInput[i] = true;
+            }
+
         }
     }
 #endif
@@ -973,13 +976,11 @@ int Platform::enterMessagePump()
             // Check for connected XInput gamepads.
             for (DWORD i = 0; i < XUSER_MAX_COUNT; i++)
             {
-                if (XInputGetState(i, &__xInputState) == NO_ERROR && !Gamepad::getGamepad(i))
+                if (XInputGetState(i, &__xInputState) == NO_ERROR && !__connectedXInput[i])
                 {
                     // Gamepad was just connected.
-                    char id[9];
-                    sprintf(id, "XInput %d", i);
-                    Gamepad::add(id, i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT,
-                                    0, 0, "Unknown", "XInput Gamepad");
+                    Platform::gamepadEventConnectedInternal(i, XINPUT_BUTTON_COUNT, XINPUT_JOYSTICK_COUNT, XINPUT_TRIGGER_COUNT, 0, 0, "Microsoft", "XBox360 Controller");
+                    __connectedXInput[i] = true;
                 }
             }
 #endif
@@ -1234,7 +1235,8 @@ void Platform::pollGamepadState(Gamepad* gamepad)
     else
     {
         // Gamepad was disconnected.
-        Gamepad::remove(gamepad);
+        Platform::gamepadEventDisconnectedInternal(gamepad->_handle);
+        __connectedXInput[gamepad->_handle] = false;
     }
 }
 #else
@@ -1278,8 +1280,15 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
+{
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
+
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
 {
+    Gamepad::remove(handle);
 }
 
 bool Platform::launchURL(const char* url)

+ 8 - 1
gameplay/src/PlatformiOS.mm

@@ -1390,8 +1390,15 @@ bool Platform::mouseEventInternal(Mouse::MouseEvent evt, int x, int y, int wheel
     }
 }
 
-void Platform::gamepadEventInternal(Gamepad::GamepadEvent evt, Gamepad* gamepad)
+void Platform::gamepadEventConnectedInternal(GamepadHandle handle,  unsigned int buttonCount, unsigned int joystickCount, unsigned int triggerCount,
+                                             unsigned int vendorId, unsigned int productId, const char* vendorString, const char* productString)
 {
+    Gamepad::add(handle, buttonCount, joystickCount, triggerCount, vendorId, productId, vendorString, productString);
+}
+
+void Platform::gamepadEventDisconnectedInternal(GamepadHandle handle)
+{
+    Gamepad::remove(handle);
 }
 
 bool Platform::isGestureSupported(Gesture::GestureEvent evt)

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

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

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

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

+ 1 - 78
gameplay/src/lua/lua_Gamepad.cpp

@@ -17,7 +17,6 @@ void luaRegister_Gamepad()
         {"draw", lua_Gamepad_draw},
         {"getButtonCount", lua_Gamepad_getButtonCount},
         {"getForm", lua_Gamepad_getForm},
-        {"getId", lua_Gamepad_getId},
         {"getJoystickCount", lua_Gamepad_getJoystickCount},
         {"getJoystickValues", lua_Gamepad_getJoystickValues},
         {"getProductId", lua_Gamepad_getProductId},
@@ -31,11 +30,7 @@ void luaRegister_Gamepad()
         {"update", lua_Gamepad_update},
         {NULL, NULL}
     };
-    const luaL_Reg lua_statics[] = 
-    {
-        {"getGamepads", lua_Gamepad_static_getGamepads},
-        {NULL, NULL}
-    };
+    const luaL_Reg* lua_statics = NULL;
     std::vector<std::string> scopePath;
 
     ScriptUtil::registerClass("Gamepad", lua_members, NULL, NULL, lua_statics, scopePath);
@@ -159,41 +154,6 @@ int lua_Gamepad_getForm(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_getId(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
-            {
-                Gamepad* instance = getInstance(state);
-                const char* result = instance->getId();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Gamepad_getId - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Gamepad_getJoystickCount(lua_State* state)
 {
     // Get the number of parameters.
@@ -563,43 +523,6 @@ int lua_Gamepad_isVirtual(lua_State* state)
     return 0;
 }
 
-int lua_Gamepad_static_getGamepads(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 0:
-        {
-            void* returnPtr = (void*)Gamepad::getGamepads();
-            if (returnPtr)
-            {
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                object->instance = returnPtr;
-                object->owns = false;
-                luaL_getmetatable(state, "Gamepad");
-                lua_setmetatable(state, -2);
-            }
-            else
-            {
-                lua_pushnil(state);
-            }
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
 int lua_Gamepad_update(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -8,7 +8,6 @@ namespace gameplay
 int lua_Gamepad_draw(lua_State* state);
 int lua_Gamepad_getButtonCount(lua_State* state);
 int lua_Gamepad_getForm(lua_State* state);
-int lua_Gamepad_getId(lua_State* state);
 int lua_Gamepad_getJoystickCount(lua_State* state);
 int lua_Gamepad_getJoystickValues(lua_State* state);
 int lua_Gamepad_getProductId(lua_State* state);
@@ -19,7 +18,6 @@ int lua_Gamepad_getVendorId(lua_State* state);
 int lua_Gamepad_getVendorString(lua_State* state);
 int lua_Gamepad_isButtonDown(lua_State* state);
 int lua_Gamepad_isVirtual(lua_State* state);
-int lua_Gamepad_static_getGamepads(lua_State* state);
 int lua_Gamepad_update(lua_State* state);
 
 void luaRegister_Gamepad();

+ 1 - 1012
gameplay/src/lua/lua_Platform.cpp

@@ -2,11 +2,6 @@
 #include "ScriptController.h"
 #include "lua_Platform.h"
 #include "Platform.h"
-#include "lua_GamepadGamepadEvent.h"
-#include "lua_GestureGestureEvent.h"
-#include "lua_KeyboardKeyEvent.h"
-#include "lua_MouseMouseEvent.h"
-#include "lua_TouchTouchEvent.h"
 
 namespace gameplay
 {
@@ -18,39 +13,7 @@ void luaRegister_Platform()
         {"enterMessagePump", lua_Platform_enterMessagePump},
         {NULL, NULL}
     };
-    const luaL_Reg lua_statics[] = 
-    {
-        {"canExit", lua_Platform_static_canExit},
-        {"displayKeyboard", lua_Platform_static_displayKeyboard},
-        {"gamepadEventInternal", lua_Platform_static_gamepadEventInternal},
-        {"getAbsoluteTime", lua_Platform_static_getAbsoluteTime},
-        {"getAccelerometerValues", lua_Platform_static_getAccelerometerValues},
-        {"getDisplayHeight", lua_Platform_static_getDisplayHeight},
-        {"getDisplayWidth", lua_Platform_static_getDisplayWidth},
-        {"hasMouse", lua_Platform_static_hasMouse},
-        {"isCursorVisible", lua_Platform_static_isCursorVisible},
-        {"isGestureRegistered", lua_Platform_static_isGestureRegistered},
-        {"isGestureSupported", lua_Platform_static_isGestureSupported},
-        {"isMouseCaptured", lua_Platform_static_isMouseCaptured},
-        {"isMultiTouch", lua_Platform_static_isMultiTouch},
-        {"isVsync", lua_Platform_static_isVsync},
-        {"keyEventInternal", lua_Platform_static_keyEventInternal},
-        {"launchURL", lua_Platform_static_launchURL},
-        {"mouseEventInternal", lua_Platform_static_mouseEventInternal},
-        {"pollGamepadState", lua_Platform_static_pollGamepadState},
-        {"registerGesture", lua_Platform_static_registerGesture},
-        {"setAbsoluteTime", lua_Platform_static_setAbsoluteTime},
-        {"setCursorVisible", lua_Platform_static_setCursorVisible},
-        {"setMouseCaptured", lua_Platform_static_setMouseCaptured},
-        {"setMultiTouch", lua_Platform_static_setMultiTouch},
-        {"setVsync", lua_Platform_static_setVsync},
-        {"signalShutdown", lua_Platform_static_signalShutdown},
-        {"sleep", lua_Platform_static_sleep},
-        {"swapBuffers", lua_Platform_static_swapBuffers},
-        {"touchEventInternal", lua_Platform_static_touchEventInternal},
-        {"unregisterGesture", lua_Platform_static_unregisterGesture},
-        {NULL, NULL}
-    };
+    const luaL_Reg* lua_statics = NULL;
     std::vector<std::string> scopePath;
 
     ScriptUtil::registerClass("Platform", lua_members, NULL, lua_Platform__gc, lua_statics, scopePath);
@@ -136,978 +99,4 @@ int lua_Platform_enterMessagePump(lua_State* state)
     return 0;
 }
 
-int lua_Platform_static_canExit(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:
-        {
-            bool result = Platform::canExit();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_displayKeyboard(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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = ScriptUtil::luaCheckBool(state, 1);
-
-                Platform::displayKeyboard(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_displayKeyboard - 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_gamepadEventInternal(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Gamepad::GamepadEvent param1 = (Gamepad::GamepadEvent)lua_enumFromString_GamepadGamepadEvent(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                bool param2Valid;
-                ScriptUtil::LuaArray<Gamepad> param2 = ScriptUtil::getObjectPointer<Gamepad>(2, "Gamepad", false, &param2Valid);
-                if (!param2Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Gamepad'.");
-                    lua_error(state);
-                }
-
-                Platform::gamepadEventInternal(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_gamepadEventInternal - 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_getAbsoluteTime(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:
-        {
-            double result = Platform::getAbsoluteTime();
-
-            // Push the return value onto the stack.
-            lua_pushnumber(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_getAccelerometerValues(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_TTABLE || lua_type(state, 1) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA))
-            {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<float> param1 = ScriptUtil::getFloatPointer(1);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<float> param2 = ScriptUtil::getFloatPointer(2);
-
-                Platform::getAccelerometerValues(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_getAccelerometerValues - 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_getDisplayHeight(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::getDisplayHeight();
-
-            // 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_getDisplayWidth(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::getDisplayWidth();
-
-            // Push the return value onto the stack.
-            lua_pushunsigned(state, result);
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_hasMouse(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 0:
-        {
-            bool result = Platform::hasMouse();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_isCursorVisible(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:
-        {
-            bool result = Platform::isCursorVisible();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_isGestureRegistered(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_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 1));
-
-                bool result = Platform::isGestureRegistered(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_isGestureRegistered - 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_isGestureSupported(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_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 1));
-
-                bool result = Platform::isGestureSupported(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_isGestureSupported - 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_isMouseCaptured(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:
-        {
-            bool result = Platform::isMouseCaptured();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_isMultiTouch(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:
-        {
-            bool result = Platform::isMultiTouch();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_isVsync(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:
-        {
-            bool result = Platform::isVsync();
-
-            // Push the return value onto the stack.
-            lua_pushboolean(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_keyEventInternal(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_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                Keyboard::KeyEvent param1 = (Keyboard::KeyEvent)lua_enumFromString_KeyboardKeyEvent(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                int param2 = (int)luaL_checkint(state, 2);
-
-                Platform::keyEventInternal(param1, param2);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_keyEventInternal - 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_launchURL(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_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(1, false);
-
-                bool result = Platform::launchURL(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_launchURL - 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_mouseEventInternal(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 4:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                Mouse::MouseEvent param1 = (Mouse::MouseEvent)lua_enumFromString_MouseMouseEvent(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                int param2 = (int)luaL_checkint(state, 2);
-
-                // Get parameter 3 off the stack.
-                int param3 = (int)luaL_checkint(state, 3);
-
-                // Get parameter 4 off the stack.
-                int param4 = (int)luaL_checkint(state, 4);
-
-                bool result = Platform::mouseEventInternal(param1, param2, param3, param4);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_mouseEventInternal - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 4).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_pollGamepadState(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                bool param1Valid;
-                ScriptUtil::LuaArray<Gamepad> param1 = ScriptUtil::getObjectPointer<Gamepad>(1, "Gamepad", false, &param1Valid);
-                if (!param1Valid)
-                {
-                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Gamepad'.");
-                    lua_error(state);
-                }
-
-                Platform::pollGamepadState(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_pollGamepadState - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_registerGesture(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 1));
-
-                Platform::registerGesture(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_registerGesture - 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_setAbsoluteTime(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.
-                double param1 = (double)luaL_checknumber(state, 1);
-
-                Platform::setAbsoluteTime(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_setAbsoluteTime - 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_setCursorVisible(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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = ScriptUtil::luaCheckBool(state, 1);
-
-                Platform::setCursorVisible(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_setCursorVisible - 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_setMouseCaptured(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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = ScriptUtil::luaCheckBool(state, 1);
-
-                Platform::setMouseCaptured(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_setMouseCaptured - 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_setMultiTouch(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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = ScriptUtil::luaCheckBool(state, 1);
-
-                Platform::setMultiTouch(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_setMultiTouch - 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_setVsync(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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                bool param1 = ScriptUtil::luaCheckBool(state, 1);
-
-                Platform::setVsync(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_setVsync - 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_signalShutdown(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:
-        {
-            Platform::signalShutdown();
-            
-            return 0;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_sleep(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.
-                long param1 = (long)luaL_checklong(state, 1);
-
-                Platform::sleep(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_sleep - 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_swapBuffers(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:
-        {
-            Platform::swapBuffers();
-            
-            return 0;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_touchEventInternal(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 4:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                Touch::TouchEvent param1 = (Touch::TouchEvent)lua_enumFromString_TouchTouchEvent(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                int param2 = (int)luaL_checkint(state, 2);
-
-                // Get parameter 3 off the stack.
-                int param3 = (int)luaL_checkint(state, 3);
-
-                // Get parameter 4 off the stack.
-                unsigned int param4 = (unsigned int)luaL_checkunsigned(state, 4);
-
-                Platform::touchEventInternal(param1, param2, param3, param4);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_touchEventInternal - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 4).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Platform_static_unregisterGesture(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_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Gesture::GestureEvent param1 = (Gesture::GestureEvent)lua_enumFromString_GestureGestureEvent(luaL_checkstring(state, 1));
-
-                Platform::unregisterGesture(param1);
-                
-                return 0;
-            }
-
-            lua_pushstring(state, "lua_Platform_static_unregisterGesture - 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;
-}
-
 }

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

@@ -7,35 +7,6 @@ namespace gameplay
 // Lua bindings for Platform.
 int lua_Platform__gc(lua_State* state);
 int lua_Platform_enterMessagePump(lua_State* state);
-int lua_Platform_static_canExit(lua_State* state);
-int lua_Platform_static_displayKeyboard(lua_State* state);
-int lua_Platform_static_gamepadEventInternal(lua_State* state);
-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_hasMouse(lua_State* state);
-int lua_Platform_static_isCursorVisible(lua_State* state);
-int lua_Platform_static_isGestureRegistered(lua_State* state);
-int lua_Platform_static_isGestureSupported(lua_State* state);
-int lua_Platform_static_isMouseCaptured(lua_State* state);
-int lua_Platform_static_isMultiTouch(lua_State* state);
-int lua_Platform_static_isVsync(lua_State* state);
-int lua_Platform_static_keyEventInternal(lua_State* state);
-int lua_Platform_static_launchURL(lua_State* state);
-int lua_Platform_static_mouseEventInternal(lua_State* state);
-int lua_Platform_static_pollGamepadState(lua_State* state);
-int lua_Platform_static_registerGesture(lua_State* state);
-int lua_Platform_static_setAbsoluteTime(lua_State* state);
-int lua_Platform_static_setCursorVisible(lua_State* state);
-int lua_Platform_static_setMouseCaptured(lua_State* state);
-int lua_Platform_static_setMultiTouch(lua_State* state);
-int lua_Platform_static_setVsync(lua_State* state);
-int lua_Platform_static_signalShutdown(lua_State* state);
-int lua_Platform_static_sleep(lua_State* state);
-int lua_Platform_static_swapBuffers(lua_State* state);
-int lua_Platform_static_touchEventInternal(lua_State* state);
-int lua_Platform_static_unregisterGesture(lua_State* state);
 
 void luaRegister_Platform();