mirror of
https://github.com/love2d/love.git
synced 2026-08-21 13:09:56 +02:00
Apply the 1-indexed joysticks patch from issue #391.
Submitted by: Alexander Szpakowski
This commit is contained in:
@@ -157,7 +157,7 @@ namespace sdl
|
|||||||
int Joystick::getAxes(lua_State * L)
|
int Joystick::getAxes(lua_State * L)
|
||||||
{
|
{
|
||||||
love::luax_assert_argc(L, 1, 1);
|
love::luax_assert_argc(L, 1, 1);
|
||||||
int index = (int)lua_tointeger(L, 1);
|
int index = (int)lua_tointeger(L, 1) - 1;
|
||||||
|
|
||||||
if (!verifyJoystick(index))
|
if (!verifyJoystick(index))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -172,8 +172,8 @@ namespace sdl
|
|||||||
int Joystick::getBall(lua_State * L)
|
int Joystick::getBall(lua_State * L)
|
||||||
{
|
{
|
||||||
love::luax_assert_argc(L, 2, 2);
|
love::luax_assert_argc(L, 2, 2);
|
||||||
int index = (int)lua_tointeger(L, 1);
|
int index = (int)lua_tointeger(L, 1) - 1;
|
||||||
int ball = (int)lua_tointeger(L, 2);
|
int ball = (int)lua_tointeger(L, 2) - 1;
|
||||||
|
|
||||||
if (!verifyJoystick(index))
|
if (!verifyJoystick(index))
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user