mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Make love.joystick 1-indexed
--HG-- branch : minor
This commit is contained in:
@@ -36,57 +36,57 @@ namespace sdl
|
|||||||
|
|
||||||
int w_getName(lua_State * L)
|
int w_getName(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
lua_pushstring(L, instance->getName(index));
|
lua_pushstring(L, instance->getName(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_open(lua_State * L)
|
int w_open(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
luax_pushboolean(L, instance->open(index));
|
luax_pushboolean(L, instance->open(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_isOpen(lua_State * L)
|
int w_isOpen(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
luax_pushboolean(L, instance->isOpen(index));
|
luax_pushboolean(L, instance->isOpen(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getNumAxes(lua_State * L)
|
int w_getNumAxes(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
lua_pushinteger(L, instance->getNumAxes(index));
|
lua_pushinteger(L, instance->getNumAxes(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getNumBalls(lua_State * L)
|
int w_getNumBalls(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
lua_pushinteger(L, instance->getNumBalls(index));
|
lua_pushinteger(L, instance->getNumBalls(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getNumButtons(lua_State * L)
|
int w_getNumButtons(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
lua_pushinteger(L, instance->getNumButtons(index));
|
lua_pushinteger(L, instance->getNumButtons(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getNumHats(lua_State * L)
|
int w_getNumHats(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
lua_pushinteger(L, instance->getNumHats(index));
|
lua_pushinteger(L, instance->getNumHats(index));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getAxis(lua_State * L)
|
int w_getAxis(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
int axis = luaL_checkint(L, 2);
|
int axis = luaL_checkint(L, 2)-1;
|
||||||
lua_pushnumber(L, instance->getAxis(index, axis));
|
lua_pushnumber(L, instance->getAxis(index, axis));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -103,16 +103,16 @@ namespace sdl
|
|||||||
|
|
||||||
int w_isDown(lua_State * L)
|
int w_isDown(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
int button = luaL_checkint(L, 2);
|
int button = luaL_checkint(L, 2)-1;
|
||||||
luax_pushboolean(L, instance->isDown(index, button));
|
luax_pushboolean(L, instance->isDown(index, button));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getHat(lua_State * L)
|
int w_getHat(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
int hat = luaL_checkint(L, 2);
|
int hat = luaL_checkint(L, 2)-1;
|
||||||
|
|
||||||
Joystick::Hat h = instance->getHat(index, hat);
|
Joystick::Hat h = instance->getHat(index, hat);
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ namespace sdl
|
|||||||
|
|
||||||
int w_close(lua_State * L)
|
int w_close(lua_State * L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1);
|
int index = luaL_checkint(L, 1)-1;
|
||||||
instance->close(index);
|
instance->close(index);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user