|
|
@@ -2,6 +2,7 @@
|
|
|
#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"
|
|
|
@@ -21,6 +22,7 @@ void luaRegister_Platform()
|
|
|
{
|
|
|
{"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},
|
|
|
@@ -196,6 +198,50 @@ int lua_Platform_static_displayKeyboard(lua_State* state)
|
|
|
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, ¶m2Valid);
|
|
|
+ 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.
|