mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Removed love.joystick.getBall and love.joystick.getBallCount (issue #648)
This commit is contained in:
@@ -146,11 +146,6 @@ int Joystick::getAxisCount(int index)
|
|||||||
return verifyJoystick(index) ? SDL_JoystickNumAxes(joysticks[index]) : 0;
|
return verifyJoystick(index) ? SDL_JoystickNumAxes(joysticks[index]) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Joystick::getBallCount(int index)
|
|
||||||
{
|
|
||||||
return verifyJoystick(index) ? SDL_JoystickNumBalls(joysticks[index]) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Joystick::getButtonCount(int index)
|
int Joystick::getButtonCount(int index)
|
||||||
{
|
{
|
||||||
return verifyJoystick(index) ? SDL_JoystickNumButtons(joysticks[index]) : 0;
|
return verifyJoystick(index) ? SDL_JoystickNumButtons(joysticks[index]) : 0;
|
||||||
@@ -194,25 +189,6 @@ int Joystick::getAxes(lua_State *L)
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Joystick::getBall(lua_State *L)
|
|
||||||
{
|
|
||||||
int index = luaL_checkint(L, 1) - 1;
|
|
||||||
int ball = luaL_checkint(L, 2) - 1;
|
|
||||||
|
|
||||||
if (!verifyJoystick(index))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (ball >= getBallCount(index))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int dx, dy;
|
|
||||||
SDL_JoystickGetBall(joysticks[index], ball, &dx, &dy);
|
|
||||||
|
|
||||||
lua_pushnumber(L, dx);
|
|
||||||
lua_pushnumber(L, dy);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Joystick::isDown(int index, int *buttonlist)
|
bool Joystick::isDown(int index, int *buttonlist)
|
||||||
{
|
{
|
||||||
if (!verifyJoystick(index))
|
if (!verifyJoystick(index))
|
||||||
|
|||||||
@@ -54,13 +54,11 @@ public:
|
|||||||
bool isOpen(int index);
|
bool isOpen(int index);
|
||||||
bool verifyJoystick(int index);
|
bool verifyJoystick(int index);
|
||||||
int getAxisCount(int index);
|
int getAxisCount(int index);
|
||||||
int getBallCount(int index);
|
|
||||||
int getButtonCount(int index);
|
int getButtonCount(int index);
|
||||||
int getHatCount(int index);
|
int getHatCount(int index);
|
||||||
float clampval(float x);
|
float clampval(float x);
|
||||||
float getAxis(int index, int axis);
|
float getAxis(int index, int axis);
|
||||||
int getAxes(lua_State *L);
|
int getAxes(lua_State *L);
|
||||||
int getBall(lua_State *L);
|
|
||||||
bool isDown(int index, int *buttonlist);
|
bool isDown(int index, int *buttonlist);
|
||||||
Hat getHat(int index, int hat);
|
Hat getHat(int index, int hat);
|
||||||
void close(int index);
|
void close(int index);
|
||||||
|
|||||||
@@ -62,13 +62,6 @@ int w_getAxisCount(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getBallCount(lua_State *L)
|
|
||||||
{
|
|
||||||
int index = luaL_checkint(L, 1) - 1;
|
|
||||||
lua_pushinteger(L, instance->getBallCount(index));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_getButtonCount(lua_State *L)
|
int w_getButtonCount(lua_State *L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1) - 1;
|
int index = luaL_checkint(L, 1) - 1;
|
||||||
@@ -96,11 +89,6 @@ int w_getAxes(lua_State *L)
|
|||||||
return instance->getAxes(L);
|
return instance->getAxes(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getBall(lua_State *L)
|
|
||||||
{
|
|
||||||
return instance->getBall(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_isDown(lua_State *L)
|
int w_isDown(lua_State *L)
|
||||||
{
|
{
|
||||||
int index = luaL_checkint(L, 1) - 1;
|
int index = luaL_checkint(L, 1) - 1;
|
||||||
@@ -140,14 +128,10 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getJoystickCount", w_getJoystickCount },
|
{ "getJoystickCount", w_getJoystickCount },
|
||||||
{ "getName", w_getName },
|
{ "getName", w_getName },
|
||||||
{ "getAxisCount", w_getAxisCount },
|
{ "getAxisCount", w_getAxisCount },
|
||||||
{ "getBallCount", w_getBallCount },
|
|
||||||
{ "getButtonCount", w_getButtonCount },
|
{ "getButtonCount", w_getButtonCount },
|
||||||
{ "getHatCount", w_getHatCount },
|
{ "getHatCount", w_getHatCount },
|
||||||
{ "getAxis", w_getAxis },
|
{ "getAxis", w_getAxis },
|
||||||
|
|
||||||
{ "getAxes", w_getAxes },
|
{ "getAxes", w_getAxes },
|
||||||
{ "getBall", w_getBall },
|
|
||||||
|
|
||||||
{ "isDown", w_isDown },
|
{ "isDown", w_isDown },
|
||||||
{ "getHat", w_getHat },
|
{ "getHat", w_getHat },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
|
|||||||
@@ -36,12 +36,10 @@ int w_reload(lua_State *L);
|
|||||||
int w_getJoystickCount(lua_State *L);
|
int w_getJoystickCount(lua_State *L);
|
||||||
int w_getName(lua_State *L);
|
int w_getName(lua_State *L);
|
||||||
int w_getAxisCount(lua_State *L);
|
int w_getAxisCount(lua_State *L);
|
||||||
int w_getBallCount(lua_State *L);
|
|
||||||
int w_getButtonCount(lua_State *L);
|
int w_getButtonCount(lua_State *L);
|
||||||
int w_getHatCount(lua_State *L);
|
int w_getHatCount(lua_State *L);
|
||||||
int w_getAxis(lua_State *L);
|
int w_getAxis(lua_State *L);
|
||||||
int w_getAxes(lua_State *L);
|
int w_getAxes(lua_State *L);
|
||||||
int w_getBall(lua_State *L);
|
|
||||||
int w_isDown(lua_State *L);
|
int w_isDown(lua_State *L);
|
||||||
int w_getHat(lua_State *L);
|
int w_getHat(lua_State *L);
|
||||||
extern "C" LOVE_EXPORT int luaopen_love_joystick(lua_State *L);
|
extern "C" LOVE_EXPORT int luaopen_love_joystick(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user