mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602)
This commit is contained in:
@@ -41,7 +41,7 @@ Joystick::Joystick()
|
||||
SDL_JoystickEventState(SDL_ENABLE);
|
||||
|
||||
// Open all connected joysticks.
|
||||
int numjoysticks = this->getNumJoysticks();
|
||||
int numjoysticks = getJoystickCount();
|
||||
if (numjoysticks > 0)
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
|
||||
@@ -52,7 +52,7 @@ Joystick::Joystick()
|
||||
Joystick::~Joystick()
|
||||
{
|
||||
// Closes any open joysticks.
|
||||
for (int i = 0; i != getNumJoysticks(); i++)
|
||||
for (int i = 0; i != getJoystickCount(); i++)
|
||||
{
|
||||
if (isOpen(i))
|
||||
close(i);
|
||||
@@ -66,7 +66,7 @@ Joystick::~Joystick()
|
||||
void Joystick::reload()
|
||||
{
|
||||
// Closes any open joysticks.
|
||||
for (int i = 0; i != getNumJoysticks(); i++)
|
||||
for (int i = 0; i != getJoystickCount(); i++)
|
||||
{
|
||||
if (isOpen(i))
|
||||
close(i);
|
||||
@@ -79,7 +79,7 @@ void Joystick::reload()
|
||||
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
|
||||
throw love::Exception("%s", SDL_GetError());
|
||||
|
||||
int numjoysticks = this->getNumJoysticks();
|
||||
int numjoysticks = this->getJoystickCount();
|
||||
if (numjoysticks > 0)
|
||||
this->joysticks = (SDL_Joystick **)calloc(numjoysticks, sizeof(SDL_Joystick *));
|
||||
|
||||
@@ -94,10 +94,10 @@ const char *Joystick::getName() const
|
||||
|
||||
bool Joystick::checkIndex(int index)
|
||||
{
|
||||
return index >= 0 && index < getNumJoysticks();
|
||||
return index >= 0 && index < getJoystickCount();
|
||||
}
|
||||
|
||||
int Joystick::getNumJoysticks()
|
||||
int Joystick::getJoystickCount()
|
||||
{
|
||||
int num = SDL_NumJoysticks();
|
||||
return num < 0 ? 0 : num;
|
||||
@@ -141,22 +141,22 @@ bool Joystick::verifyJoystick(int index)
|
||||
return true;
|
||||
}
|
||||
|
||||
int Joystick::getNumAxes(int index)
|
||||
int Joystick::getAxisCount(int index)
|
||||
{
|
||||
return verifyJoystick(index) ? SDL_JoystickNumAxes(joysticks[index]) : 0;
|
||||
}
|
||||
|
||||
int Joystick::getNumBalls(int index)
|
||||
int Joystick::getBallCount(int index)
|
||||
{
|
||||
return verifyJoystick(index) ? SDL_JoystickNumBalls(joysticks[index]) : 0;
|
||||
}
|
||||
|
||||
int Joystick::getNumButtons(int index)
|
||||
int Joystick::getButtonCount(int index)
|
||||
{
|
||||
return verifyJoystick(index) ? SDL_JoystickNumButtons(joysticks[index]) : 0;
|
||||
}
|
||||
|
||||
int Joystick::getNumHats(int index)
|
||||
int Joystick::getHatCount(int index)
|
||||
{
|
||||
return verifyJoystick(index) ? SDL_JoystickNumHats(joysticks[index]) : 0;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ float Joystick::getAxis(int index, int axis)
|
||||
if (!verifyJoystick(index))
|
||||
return 0;
|
||||
|
||||
if (axis >= getNumAxes(index))
|
||||
if (axis >= getAxisCount(index))
|
||||
return 0;
|
||||
|
||||
return clampval(((float)SDL_JoystickGetAxis(joysticks[index], axis))/32768.0f);
|
||||
@@ -188,7 +188,7 @@ int Joystick::getAxes(lua_State *L)
|
||||
if (!verifyJoystick(index))
|
||||
return 0;
|
||||
|
||||
int num = getNumAxes(index);
|
||||
int num = getAxisCount(index);
|
||||
|
||||
for (int i = 0; i<num; i++)
|
||||
lua_pushnumber(L, clampval(((float)SDL_JoystickGetAxis(joysticks[index], i))/32768.0f));
|
||||
@@ -204,7 +204,7 @@ int Joystick::getBall(lua_State *L)
|
||||
if (!verifyJoystick(index))
|
||||
return 0;
|
||||
|
||||
if (ball >= getNumBalls(index))
|
||||
if (ball >= getBallCount(index))
|
||||
return 0;
|
||||
|
||||
int dx, dy;
|
||||
@@ -220,7 +220,7 @@ bool Joystick::isDown(int index, int *buttonlist)
|
||||
if (!verifyJoystick(index))
|
||||
return false;
|
||||
|
||||
int num = getNumButtons(index);
|
||||
int num = getButtonCount(index);
|
||||
|
||||
for (int button = *buttonlist; button != -1; button = *(++buttonlist))
|
||||
{
|
||||
@@ -238,7 +238,7 @@ Joystick::Hat Joystick::getHat(int index, int hat)
|
||||
if (!verifyJoystick(index))
|
||||
return h;
|
||||
|
||||
if (hat >= getNumHats(index))
|
||||
if (hat >= getHatCount(index))
|
||||
return h;
|
||||
|
||||
hats.find(SDL_JoystickGetHat(joysticks[index], hat), h);
|
||||
|
||||
@@ -48,15 +48,15 @@ public:
|
||||
|
||||
void reload();
|
||||
bool checkIndex(int index);
|
||||
int getNumJoysticks();
|
||||
int getJoystickCount();
|
||||
const char *getName(int index);
|
||||
bool open(int index);
|
||||
bool isOpen(int index);
|
||||
bool verifyJoystick(int index);
|
||||
int getNumAxes(int index);
|
||||
int getNumBalls(int index);
|
||||
int getNumButtons(int index);
|
||||
int getNumHats(int index);
|
||||
int getAxisCount(int index);
|
||||
int getBallCount(int index);
|
||||
int getButtonCount(int index);
|
||||
int getHatCount(int index);
|
||||
float clampval(float x);
|
||||
float getAxis(int index, int axis);
|
||||
int getAxes(lua_State *L);
|
||||
|
||||
@@ -42,9 +42,9 @@ int w_reload(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_getNumJoysticks(lua_State *L)
|
||||
int w_getJoystickCount(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, instance->getNumJoysticks());
|
||||
lua_pushinteger(L, instance->getJoystickCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -55,31 +55,31 @@ int w_getName(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getNumAxes(lua_State *L)
|
||||
int w_getAxisCount(lua_State *L)
|
||||
{
|
||||
int index = luaL_checkint(L, 1)-1;
|
||||
lua_pushinteger(L, instance->getNumAxes(index));
|
||||
lua_pushinteger(L, instance->getAxisCount(index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getNumBalls(lua_State *L)
|
||||
int w_getBallCount(lua_State *L)
|
||||
{
|
||||
int index = luaL_checkint(L, 1)-1;
|
||||
lua_pushinteger(L, instance->getNumBalls(index));
|
||||
lua_pushinteger(L, instance->getBallCount(index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getNumButtons(lua_State *L)
|
||||
int w_getButtonCount(lua_State *L)
|
||||
{
|
||||
int index = luaL_checkint(L, 1)-1;
|
||||
lua_pushinteger(L, instance->getNumButtons(index));
|
||||
lua_pushinteger(L, instance->getButtonCount(index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getNumHats(lua_State *L)
|
||||
int w_getHatCount(lua_State *L)
|
||||
{
|
||||
int index = luaL_checkint(L, 1)-1;
|
||||
lua_pushinteger(L, instance->getNumHats(index));
|
||||
lua_pushinteger(L, instance->getHatCount(index));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -137,12 +137,12 @@ int w_getHat(lua_State *L)
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "reload", w_reload },
|
||||
{ "getNumJoysticks", w_getNumJoysticks },
|
||||
{ "getJoystickCount", w_getJoystickCount },
|
||||
{ "getName", w_getName },
|
||||
{ "getNumAxes", w_getNumAxes },
|
||||
{ "getNumBalls", w_getNumBalls },
|
||||
{ "getNumButtons", w_getNumButtons },
|
||||
{ "getNumHats", w_getNumHats },
|
||||
{ "getAxisCount", w_getAxisCount },
|
||||
{ "getBallCount", w_getBallCount },
|
||||
{ "getButtonCount", w_getButtonCount },
|
||||
{ "getHatCount", w_getHatCount },
|
||||
{ "getAxis", w_getAxis },
|
||||
|
||||
{ "getAxes", w_getAxes },
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace sdl
|
||||
{
|
||||
|
||||
int w_reload(lua_State *L);
|
||||
int w_getNumJoysticks(lua_State *L);
|
||||
int w_getJoystickCount(lua_State *L);
|
||||
int w_getName(lua_State *L);
|
||||
int w_getNumAxes(lua_State *L);
|
||||
int w_getNumBalls(lua_State *L);
|
||||
int w_getNumButtons(lua_State *L);
|
||||
int w_getNumHats(lua_State *L);
|
||||
int w_getAxisCount(lua_State *L);
|
||||
int w_getBallCount(lua_State *L);
|
||||
int w_getButtonCount(lua_State *L);
|
||||
int w_getHatCount(lua_State *L);
|
||||
int w_getAxis(lua_State *L);
|
||||
int w_getAxes(lua_State *L);
|
||||
int w_getBall(lua_State *L);
|
||||
|
||||
Reference in New Issue
Block a user