|
|
@@ -2,11 +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"
|
|
|
-#include "lua_TouchTouchEvent.h"
|
|
|
|
|
|
namespace gameplay
|
|
|
{
|
|
|
@@ -22,7 +18,6 @@ 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},
|
|
|
@@ -34,9 +29,7 @@ void luaRegister_Platform()
|
|
|
{"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},
|
|
|
@@ -47,7 +40,6 @@ void luaRegister_Platform()
|
|
|
{"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}
|
|
|
};
|
|
|
@@ -198,50 +190,6 @@ 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.
|
|
|
@@ -578,44 +526,6 @@ int lua_Platform_static_isVsync(lua_State* state)
|
|
|
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.
|
|
|
@@ -653,55 +563,6 @@ int lua_Platform_static_launchURL(lua_State* state)
|
|
|
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.
|
|
|
@@ -1030,52 +891,6 @@ int lua_Platform_static_swapBuffers(lua_State* state)
|
|
|
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.
|