|
@@ -25,17 +25,17 @@ void luaRegister_Platform()
|
|
|
{"getDisplayWidth", lua_Platform_static_getDisplayWidth},
|
|
{"getDisplayWidth", lua_Platform_static_getDisplayWidth},
|
|
|
{"getGamepadButtonCount", lua_Platform_static_getGamepadButtonCount},
|
|
{"getGamepadButtonCount", lua_Platform_static_getGamepadButtonCount},
|
|
|
{"getGamepadButtonState", lua_Platform_static_getGamepadButtonState},
|
|
{"getGamepadButtonState", lua_Platform_static_getGamepadButtonState},
|
|
|
- {"getGamepadCount", lua_Platform_static_getGamepadCount},
|
|
|
|
|
{"getGamepadId", lua_Platform_static_getGamepadId},
|
|
{"getGamepadId", lua_Platform_static_getGamepadId},
|
|
|
|
|
+ {"getGamepadJoystickAxisValues", lua_Platform_static_getGamepadJoystickAxisValues},
|
|
|
|
|
+ {"getGamepadJoystickAxisX", lua_Platform_static_getGamepadJoystickAxisX},
|
|
|
|
|
+ {"getGamepadJoystickAxisY", lua_Platform_static_getGamepadJoystickAxisY},
|
|
|
{"getGamepadJoystickCount", lua_Platform_static_getGamepadJoystickCount},
|
|
{"getGamepadJoystickCount", lua_Platform_static_getGamepadJoystickCount},
|
|
|
- {"getGamepadJoystickValue", lua_Platform_static_getGamepadJoystickValue},
|
|
|
|
|
- {"getGamepadJoystickXAxis", lua_Platform_static_getGamepadJoystickXAxis},
|
|
|
|
|
- {"getGamepadJoystickYAxis", lua_Platform_static_getGamepadJoystickYAxis},
|
|
|
|
|
{"getGamepadTriggerCount", lua_Platform_static_getGamepadTriggerCount},
|
|
{"getGamepadTriggerCount", lua_Platform_static_getGamepadTriggerCount},
|
|
|
{"getGamepadTriggerValue", lua_Platform_static_getGamepadTriggerValue},
|
|
{"getGamepadTriggerValue", lua_Platform_static_getGamepadTriggerValue},
|
|
|
|
|
+ {"getGamepadsConnected", lua_Platform_static_getGamepadsConnected},
|
|
|
{"hasMouse", lua_Platform_static_hasMouse},
|
|
{"hasMouse", lua_Platform_static_hasMouse},
|
|
|
{"isCursorVisible", lua_Platform_static_isCursorVisible},
|
|
{"isCursorVisible", lua_Platform_static_isCursorVisible},
|
|
|
- {"isGamepadAttached", lua_Platform_static_isGamepadAttached},
|
|
|
|
|
|
|
+ {"isGamepadConnected", lua_Platform_static_isGamepadConnected},
|
|
|
{"isGamepadJoystickActive", lua_Platform_static_isGamepadJoystickActive},
|
|
{"isGamepadJoystickActive", lua_Platform_static_isGamepadJoystickActive},
|
|
|
{"isMouseCaptured", lua_Platform_static_isMouseCaptured},
|
|
{"isMouseCaptured", lua_Platform_static_isMouseCaptured},
|
|
|
{"isMultiTouch", lua_Platform_static_isMultiTouch},
|
|
{"isMultiTouch", lua_Platform_static_isMultiTouch},
|
|
@@ -384,34 +384,6 @@ int lua_Platform_static_getGamepadButtonState(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_getGamepadCount(lua_State* state)
|
|
|
|
|
-{
|
|
|
|
|
- // Get the number of parameters.
|
|
|
|
|
- int paramCount = lua_gettop(state);
|
|
|
|
|
-
|
|
|
|
|
- // Attempt to match the parameters to a valid binding.
|
|
|
|
|
- switch (paramCount)
|
|
|
|
|
- {
|
|
|
|
|
- case 0:
|
|
|
|
|
- {
|
|
|
|
|
- unsigned int result = Platform::getGamepadCount();
|
|
|
|
|
-
|
|
|
|
|
- // Push the return value onto the stack.
|
|
|
|
|
- lua_pushunsigned(state, result);
|
|
|
|
|
-
|
|
|
|
|
- return 1;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- default:
|
|
|
|
|
- {
|
|
|
|
|
- lua_pushstring(state, "Invalid number of parameters (expected 0).");
|
|
|
|
|
- lua_error(state);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return 0;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
int lua_Platform_static_getGamepadId(lua_State* state)
|
|
int lua_Platform_static_getGamepadId(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
@@ -451,7 +423,7 @@ int lua_Platform_static_getGamepadId(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
|
|
|
|
|
|
|
+int lua_Platform_static_getGamepadJoystickAxisValues(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
int paramCount = lua_gettop(state);
|
|
@@ -459,30 +431,35 @@ int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
|
|
|
// Attempt to match the parameters to a valid binding.
|
|
// Attempt to match the parameters to a valid binding.
|
|
|
switch (paramCount)
|
|
switch (paramCount)
|
|
|
{
|
|
{
|
|
|
- case 1:
|
|
|
|
|
|
|
+ case 3:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TNUMBER)
|
|
|
|
|
|
|
+ if (lua_type(state, 1) == LUA_TNUMBER &&
|
|
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
|
|
+ (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
|
|
|
|
|
|
- unsigned int result = Platform::getGamepadJoystickCount(param1);
|
|
|
|
|
|
|
+ // Get parameter 2 off the stack.
|
|
|
|
|
+ unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
|
|
|
|
|
|
- // Push the return value onto the stack.
|
|
|
|
|
- lua_pushunsigned(state, result);
|
|
|
|
|
|
|
+ // Get parameter 3 off the stack.
|
|
|
|
|
+ Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false);
|
|
|
|
|
|
|
|
- return 1;
|
|
|
|
|
|
|
+ Platform::getGamepadJoystickAxisValues(param1, param2, param3);
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "lua_Platform_static_getGamepadJoystickCount - Failed to match the given parameters to a valid function signature.");
|
|
|
|
|
|
|
+ lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisValues - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
default:
|
|
default:
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "Invalid number of parameters (expected 1).");
|
|
|
|
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 3).");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -490,7 +467,7 @@ int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_getGamepadJoystickValue(lua_State* state)
|
|
|
|
|
|
|
+int lua_Platform_static_getGamepadJoystickAxisX(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
int paramCount = lua_gettop(state);
|
|
@@ -498,11 +475,10 @@ int lua_Platform_static_getGamepadJoystickValue(lua_State* state)
|
|
|
// Attempt to match the parameters to a valid binding.
|
|
// Attempt to match the parameters to a valid binding.
|
|
|
switch (paramCount)
|
|
switch (paramCount)
|
|
|
{
|
|
{
|
|
|
- case 3:
|
|
|
|
|
|
|
+ case 2:
|
|
|
{
|
|
{
|
|
|
if (lua_type(state, 1) == LUA_TNUMBER &&
|
|
if (lua_type(state, 1) == LUA_TNUMBER &&
|
|
|
- lua_type(state, 2) == LUA_TNUMBER &&
|
|
|
|
|
- (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
|
|
|
|
|
|
|
+ lua_type(state, 2) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
@@ -510,23 +486,23 @@ int lua_Platform_static_getGamepadJoystickValue(lua_State* state)
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
|
|
|
|
|
|
- // Get parameter 3 off the stack.
|
|
|
|
|
- Vector2* param3 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false);
|
|
|
|
|
|
|
+ float result = Platform::getGamepadJoystickAxisX(param1, param2);
|
|
|
|
|
|
|
|
- Platform::getGamepadJoystickValue(param1, param2, param3);
|
|
|
|
|
-
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ // Push the return value onto the stack.
|
|
|
|
|
+ lua_pushnumber(state, result);
|
|
|
|
|
+
|
|
|
|
|
+ return 1;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "lua_Platform_static_getGamepadJoystickValue - Failed to match the given parameters to a valid function signature.");
|
|
|
|
|
|
|
+ lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisX - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
default:
|
|
default:
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "Invalid number of parameters (expected 3).");
|
|
|
|
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -534,7 +510,7 @@ int lua_Platform_static_getGamepadJoystickValue(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state)
|
|
|
|
|
|
|
+int lua_Platform_static_getGamepadJoystickAxisY(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
int paramCount = lua_gettop(state);
|
|
@@ -553,7 +529,7 @@ int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state)
|
|
|
// Get parameter 2 off the stack.
|
|
// Get parameter 2 off the stack.
|
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
|
|
|
|
|
|
- float result = Platform::getGamepadJoystickXAxis(param1, param2);
|
|
|
|
|
|
|
+ float result = Platform::getGamepadJoystickAxisY(param1, param2);
|
|
|
|
|
|
|
|
// Push the return value onto the stack.
|
|
// Push the return value onto the stack.
|
|
|
lua_pushnumber(state, result);
|
|
lua_pushnumber(state, result);
|
|
@@ -562,7 +538,7 @@ int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "lua_Platform_static_getGamepadJoystickXAxis - Failed to match the given parameters to a valid function signature.");
|
|
|
|
|
|
|
+ lua_pushstring(state, "lua_Platform_static_getGamepadJoystickAxisY - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
@@ -577,7 +553,7 @@ int lua_Platform_static_getGamepadJoystickXAxis(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_getGamepadJoystickYAxis(lua_State* state)
|
|
|
|
|
|
|
+int lua_Platform_static_getGamepadJoystickCount(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
int paramCount = lua_gettop(state);
|
|
@@ -585,34 +561,30 @@ int lua_Platform_static_getGamepadJoystickYAxis(lua_State* state)
|
|
|
// Attempt to match the parameters to a valid binding.
|
|
// Attempt to match the parameters to a valid binding.
|
|
|
switch (paramCount)
|
|
switch (paramCount)
|
|
|
{
|
|
{
|
|
|
- case 2:
|
|
|
|
|
|
|
+ case 1:
|
|
|
{
|
|
{
|
|
|
- if (lua_type(state, 1) == LUA_TNUMBER &&
|
|
|
|
|
- lua_type(state, 2) == LUA_TNUMBER)
|
|
|
|
|
|
|
+ if (lua_type(state, 1) == LUA_TNUMBER)
|
|
|
{
|
|
{
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
|
|
|
|
|
|
- // Get parameter 2 off the stack.
|
|
|
|
|
- unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
|
|
|
|
|
-
|
|
|
|
|
- float result = Platform::getGamepadJoystickYAxis(param1, param2);
|
|
|
|
|
|
|
+ unsigned int result = Platform::getGamepadJoystickCount(param1);
|
|
|
|
|
|
|
|
// Push the return value onto the stack.
|
|
// Push the return value onto the stack.
|
|
|
- lua_pushnumber(state, result);
|
|
|
|
|
|
|
+ lua_pushunsigned(state, result);
|
|
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "lua_Platform_static_getGamepadJoystickYAxis - Failed to match the given parameters to a valid function signature.");
|
|
|
|
|
|
|
+ lua_pushstring(state, "lua_Platform_static_getGamepadJoystickCount - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
default:
|
|
default:
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "Invalid number of parameters (expected 2).");
|
|
|
|
|
|
|
+ lua_pushstring(state, "Invalid number of parameters (expected 1).");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
@@ -702,6 +674,34 @@ int lua_Platform_static_getGamepadTriggerValue(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int lua_Platform_static_getGamepadsConnected(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::getGamepadsConnected();
|
|
|
|
|
+
|
|
|
|
|
+ // 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)
|
|
int lua_Platform_static_hasMouse(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
@@ -758,7 +758,7 @@ int lua_Platform_static_isCursorVisible(lua_State* state)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int lua_Platform_static_isGamepadAttached(lua_State* state)
|
|
|
|
|
|
|
+int lua_Platform_static_isGamepadConnected(lua_State* state)
|
|
|
{
|
|
{
|
|
|
// Get the number of parameters.
|
|
// Get the number of parameters.
|
|
|
int paramCount = lua_gettop(state);
|
|
int paramCount = lua_gettop(state);
|
|
@@ -773,7 +773,7 @@ int lua_Platform_static_isGamepadAttached(lua_State* state)
|
|
|
// Get parameter 1 off the stack.
|
|
// Get parameter 1 off the stack.
|
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
|
|
|
|
|
|
|
|
- bool result = Platform::isGamepadAttached(param1);
|
|
|
|
|
|
|
+ bool result = Platform::isGamepadConnected(param1);
|
|
|
|
|
|
|
|
// Push the return value onto the stack.
|
|
// Push the return value onto the stack.
|
|
|
lua_pushboolean(state, result);
|
|
lua_pushboolean(state, result);
|
|
@@ -782,7 +782,7 @@ int lua_Platform_static_isGamepadAttached(lua_State* state)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- lua_pushstring(state, "lua_Platform_static_isGamepadAttached - Failed to match the given parameters to a valid function signature.");
|
|
|
|
|
|
|
+ lua_pushstring(state, "lua_Platform_static_isGamepadConnected - Failed to match the given parameters to a valid function signature.");
|
|
|
lua_error(state);
|
|
lua_error(state);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|