Using latest android branch of LÖVE (6d14516b05c9) that now syncs with default (woooo!)

This commit is contained in:
fysx
2015-07-03 19:09:18 +02:00
parent 1924bbdeeb
commit 357a7237a4
304 changed files with 28694 additions and 23064 deletions
+2 -12
View File
@@ -122,17 +122,7 @@ bool Joystick::isConnected() const
const char *Joystick::getName() const
{
// Use the saved name if this Joystick isn't connected anymore.
if (!isConnected())
return name.c_str();
// Prefer the Joystick name for consistency.
const char *joyname = SDL_JoystickName(joyhandle);
if (!joyname && isGamepad())
joyname = SDL_GameControllerName(controller);
return joyname;
return name.c_str();
}
int Joystick::getAxisCount() const
@@ -342,7 +332,7 @@ bool Joystick::runVibrationEffect()
if (vibration.id != -1 && SDL_HapticRunEffect(haptic, vibration.id, 1) == 0)
return true;
return false;
}
+1 -1
View File
@@ -129,7 +129,7 @@ private:
static EnumMap<GamepadButton, SDL_GameControllerButton, GAMEPAD_BUTTON_MAX_ENUM>::Entry gpButtonEntries[];
static EnumMap<GamepadButton, SDL_GameControllerButton, GAMEPAD_BUTTON_MAX_ENUM> gpButtons;
};
} // sdl
@@ -42,7 +42,7 @@ namespace sdl
JoystickModule::JoystickModule()
{
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) < 0)
throw love::Exception("%s", SDL_GetError());
throw love::Exception("Could not initialize SDL joystick subsystem (%s)", SDL_GetError());
// Initialize any joysticks which are already connected.
for (int i = 0; i < SDL_NumJoysticks(); i++)
@@ -84,7 +84,7 @@ love::joystick::Joystick *JoystickModule::getJoystick(int joyindex)
int JoystickModule::getIndex(const love::joystick::Joystick *joystick)
{
for (size_t i = 0; i < activeSticks.size(); i++)
for (int i = 0; i < (int) activeSticks.size(); i++)
{
if (activeSticks[i] == joystick)
return i;
@@ -132,7 +132,7 @@ love::joystick::Joystick *JoystickModule::addJoystick(int deviceindex)
if (!joystick)
{
joystick = new Joystick(joysticks.size());
joystick = new Joystick((int) joysticks.size());
joysticks.push_back(joystick);
}
@@ -241,7 +241,7 @@ bool JoystickModule::setGamepadMapping(const std::string &guid, Joystick::Gamepa
std::string insertstr = gpinputname + ":" + joyinputstr + ",";
// We should replace any existing gamepad bind.
size_t findpos = mapstr.find(gpinputname + ":");
size_t findpos = mapstr.find(std::string(", ") + gpinputname + ":");
if (findpos != std::string::npos)
{
// The bind string ends at the next comma, or the end of the string.
@@ -31,7 +31,7 @@ namespace joystick
Joystick *luax_checkjoystick(lua_State *L, int idx)
{
return luax_checktype<Joystick>(L, idx, "Joystick", JOYSTICK_JOYSTICK_T);
return luax_checktype<Joystick>(L, idx, JOYSTICK_JOYSTICK_ID);
}
int w_Joystick_isConnected(lua_State *L)
@@ -95,7 +95,7 @@ int w_Joystick_getHatCount(lua_State *L)
int w_Joystick_getAxis(lua_State *L)
{
Joystick *j = luax_checkjoystick(L, 1);
int axisindex = luaL_checkint(L, 2) - 1;
int axisindex = (int) luaL_checknumber(L, 2) - 1;
lua_pushnumber(L, j->getAxis(axisindex));
return 1;
}
@@ -114,7 +114,7 @@ int w_Joystick_getAxes(lua_State *L)
int w_Joystick_getHat(lua_State *L)
{
Joystick *j = luax_checkjoystick(L, 1);
int hatindex = luaL_checkint(L, 2) - 1;
int hatindex = (int) luaL_checknumber(L, 2) - 1;
Joystick::Hat h = j->getHat(hatindex);
@@ -133,7 +133,7 @@ int w_Joystick_isDown(lua_State *L)
std::vector<int> buttons;
for (int i = 2; i <= lua_gettop(L); i++)
buttons.push_back(luaL_checkint(L, i) - 1);
buttons.push_back((int) luaL_checknumber(L, i) - 1);
luax_pushboolean(L, j->isDown(buttons));
return 1;
@@ -255,7 +255,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_joystick(lua_State *L)
{
return luax_register_type(L, "Joystick", functions);
return luax_register_type(L, JOYSTICK_JOYSTICK_ID, functions);
}
} // joystick
@@ -40,7 +40,7 @@ int w_getJoysticks(lua_State *L)
for (int i = 0; i < stickcount; i++)
{
Joystick *stick = instance()->getJoystick(i);
luax_pushtype(L, "Joystick", JOYSTICK_JOYSTICK_T, stick);
luax_pushtype(L, JOYSTICK_JOYSTICK_ID, stick);
lua_rawseti(L, -2, i + 1);
}
@@ -91,14 +91,14 @@ int w_setGamepadMapping(lua_State *L)
switch (jinput.type)
{
case Joystick::INPUT_TYPE_AXIS:
jinput.axis = luaL_checkint(L, 4) - 1;
jinput.axis = (int) luaL_checknumber(L, 4) - 1;
break;
case Joystick::INPUT_TYPE_BUTTON:
jinput.button = luaL_checkint(L, 4) - 1;
jinput.button = (int) luaL_checknumber(L, 4) - 1;
break;
case Joystick::INPUT_TYPE_HAT:
// Hats need both a hat index and a hat value.
jinput.hat.index = luaL_checkint(L, 4) - 1;
jinput.hat.index = (int) luaL_checknumber(L, 4) - 1;
hatstr = luaL_checkstring(L, 5);
if (!Joystick::getConstant(hatstr, jinput.hat.value))
return luaL_error(L, "Invalid joystick hat: %s", hatstr);
@@ -254,7 +254,7 @@ extern "C" int luaopen_love_joystick(lua_State *L)
WrappedModule w;
w.module = instance;
w.name = "joystick";
w.flags = MODULE_T;
w.type = MODULE_ID;
w.functions = functions;
w.types = types;