mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602)
This commit is contained in:
@@ -76,7 +76,7 @@ public:
|
||||
* Gets the current number of simultaneous playing sources.
|
||||
* @return The current number of simultaneous playing sources.
|
||||
**/
|
||||
virtual int getNumSources() const = 0;
|
||||
virtual int getSourceCount() const = 0;
|
||||
|
||||
/**
|
||||
* Gets the maximum supported number of simultaneous playing sources.
|
||||
|
||||
@@ -50,7 +50,7 @@ love::audio::Source *Audio::newSource(love::sound::SoundData *)
|
||||
return new Source();
|
||||
}
|
||||
|
||||
int Audio::getNumSources() const
|
||||
int Audio::getSourceCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
// Implements Audio.
|
||||
love::audio::Source *newSource(love::sound::Decoder *decoder);
|
||||
love::audio::Source *newSource(love::sound::SoundData *soundData);
|
||||
int getNumSources() const;
|
||||
int getSourceCount() const;
|
||||
int getMaxSources() const;
|
||||
void play(love::audio::Source *source);
|
||||
void play();
|
||||
|
||||
@@ -143,9 +143,9 @@ love::audio::Source *Audio::newSource(love::sound::SoundData *soundData)
|
||||
return new Source(pool, soundData);
|
||||
}
|
||||
|
||||
int Audio::getNumSources() const
|
||||
int Audio::getSourceCount() const
|
||||
{
|
||||
return pool->getNumSources();
|
||||
return pool->getSourceCount();
|
||||
}
|
||||
|
||||
int Audio::getMaxSources() const
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
// Implements Audio.
|
||||
love::audio::Source *newSource(love::sound::Decoder *decoder);
|
||||
love::audio::Source *newSource(love::sound::SoundData *soundData);
|
||||
int getNumSources() const;
|
||||
int getSourceCount() const;
|
||||
int getMaxSources() const;
|
||||
void play(love::audio::Source *source);
|
||||
void play();
|
||||
|
||||
@@ -106,7 +106,7 @@ void Pool::update()
|
||||
}
|
||||
}
|
||||
|
||||
int Pool::getNumSources() const
|
||||
int Pool::getSourceCount() const
|
||||
{
|
||||
return playing.size();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
|
||||
void update();
|
||||
|
||||
int getNumSources() const;
|
||||
int getSourceCount() const;
|
||||
int getMaxSources() const;
|
||||
|
||||
bool play(Source *source, ALuint &out);
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace audio
|
||||
|
||||
static Audio *instance = 0;
|
||||
|
||||
int w_getNumSources(lua_State *L)
|
||||
int w_getSourceCount(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, instance->getNumSources());
|
||||
lua_pushinteger(L, instance->getSourceCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ int w_getDistanceModel(lua_State *L)
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getNumSources", w_getNumSources },
|
||||
{ "getSourceCount", w_getSourceCount },
|
||||
{ "newSource1", w_newSource1 },
|
||||
{ "play", w_play },
|
||||
{ "stop", w_stop },
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace love
|
||||
namespace audio
|
||||
{
|
||||
|
||||
int w_getNumSources(lua_State *L);
|
||||
int w_getSourceCount(lua_State *L);
|
||||
int w_newSource1(lua_State *L);
|
||||
int w_play(lua_State *L);
|
||||
int w_stop(lua_State *L);
|
||||
|
||||
@@ -146,7 +146,7 @@ void ImageRasterizer::load()
|
||||
}
|
||||
}
|
||||
|
||||
int ImageRasterizer::getNumGlyphs() const
|
||||
int ImageRasterizer::getGlyphCount() const
|
||||
{
|
||||
return numglyphs;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned int glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
virtual int getGlyphCount() const;
|
||||
|
||||
private:
|
||||
// Load all the glyph positions into memory
|
||||
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
/**
|
||||
* Gets the number of glyphs the rasterizer has data for.
|
||||
**/
|
||||
virtual int getNumGlyphs() const = 0;
|
||||
virtual int getGlyphCount() const = 0;
|
||||
|
||||
|
||||
}; // Rasterizer
|
||||
|
||||
@@ -106,7 +106,7 @@ GlyphData *TrueTypeRasterizer::getGlyphData(unsigned int glyph) const
|
||||
return glyphData;
|
||||
}
|
||||
|
||||
int TrueTypeRasterizer::getNumGlyphs() const
|
||||
int TrueTypeRasterizer::getGlyphCount() const
|
||||
{
|
||||
return face->num_glyphs;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
// Implement Rasterizer
|
||||
virtual int getLineHeight() const;
|
||||
virtual GlyphData *getGlyphData(unsigned int glyph) const;
|
||||
virtual int getNumGlyphs() const;
|
||||
virtual int getGlyphCount() const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -525,7 +525,7 @@ std::vector<Color> ParticleSystem::getColor() const
|
||||
return ncolors;
|
||||
}
|
||||
|
||||
int ParticleSystem::count() const
|
||||
int ParticleSystem::getCount() const
|
||||
{
|
||||
return (int)(pLast - pStart);
|
||||
}
|
||||
@@ -587,8 +587,8 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
|
||||
{
|
||||
if (image == 0) return; // just in case of failure
|
||||
|
||||
int numParticles = count();
|
||||
if (numParticles == 0) return; // don't bother if there's nothing to do
|
||||
int num = getCount();
|
||||
if (num == 0) return; // don't bother if there's nothing to do
|
||||
|
||||
Color curcolor = gl.getColor();
|
||||
|
||||
@@ -602,7 +602,7 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
|
||||
const vertex *tVerts;
|
||||
|
||||
// set the vertex data for each particle (transformation, texcoords, color)
|
||||
for (int i = 0; i < numParticles; i++)
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
particle *p = pStart + i;
|
||||
|
||||
@@ -638,7 +638,7 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo
|
||||
glVertexPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid *)&particleVerts[0].x);
|
||||
glTexCoordPointer(2, GL_FLOAT, sizeof(vertex), (GLvoid *)&particleVerts[0].s);
|
||||
|
||||
glDrawArrays(GL_QUADS, 0, numParticles*4);
|
||||
glDrawArrays(GL_QUADS, 0, num*4);
|
||||
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
|
||||
@@ -435,7 +435,7 @@ public:
|
||||
/**
|
||||
* Returns the amount of particles that are currently active in the system.
|
||||
**/
|
||||
int count() const;
|
||||
int getCount() const;
|
||||
|
||||
/**
|
||||
* Starts/resumes the particle emitter.
|
||||
|
||||
@@ -529,10 +529,10 @@ int w_ParticleSystem_getColors(lua_State *L)
|
||||
return colors.size();
|
||||
}
|
||||
|
||||
int w_ParticleSystem_count(lua_State *L)
|
||||
int w_ParticleSystem_getCount(lua_State *L)
|
||||
{
|
||||
ParticleSystem *t = luax_checkparticlesystem(L, 1);
|
||||
lua_pushnumber(L, t->count());
|
||||
lua_pushnumber(L, t->getCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -647,7 +647,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getColors", w_ParticleSystem_getColors },
|
||||
{ "setOffset", w_ParticleSystem_setOffset },
|
||||
{ "getOffset", w_ParticleSystem_getOffset },
|
||||
{ "count", w_ParticleSystem_count },
|
||||
{ "getCount", w_ParticleSystem_getCount },
|
||||
{ "start", w_ParticleSystem_start },
|
||||
{ "stop", w_ParticleSystem_stop },
|
||||
{ "pause", w_ParticleSystem_pause },
|
||||
|
||||
@@ -78,7 +78,7 @@ int w_ParticleSystem_setColors(lua_State *L);
|
||||
int w_ParticleSystem_getColors(lua_State *L);
|
||||
int w_ParticleSystem_setOffset(lua_State *L);
|
||||
int w_ParticleSystem_getOffset(lua_State *L);
|
||||
int w_ParticleSystem_count(lua_State *L);
|
||||
int w_ParticleSystem_getCount(lua_State *L);
|
||||
int w_ParticleSystem_start(lua_State *L);
|
||||
int w_ParticleSystem_stop(lua_State *L);
|
||||
int w_ParticleSystem_pause(lua_State *L);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -176,7 +176,7 @@ Variant *Channel::peek()
|
||||
return var;
|
||||
}
|
||||
|
||||
int Channel::count()
|
||||
int Channel::getCount()
|
||||
{
|
||||
Lock l(mutex);
|
||||
return queue.size();
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
Variant *pop();
|
||||
Variant *demand(); // blocking pop
|
||||
Variant *peek();
|
||||
int count();
|
||||
int getCount();
|
||||
void clear();
|
||||
|
||||
void retain();
|
||||
|
||||
@@ -102,10 +102,10 @@ int w_Channel_peek(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Channel_count(lua_State *L)
|
||||
int w_Channel_getCount(lua_State *L)
|
||||
{
|
||||
Channel *c = luax_checkchannel(L, 1);
|
||||
lua_pushnumber(L, c->count());
|
||||
lua_pushnumber(L, c->getCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ static const luaL_Reg type_functions[] = {
|
||||
{ "pop", w_Channel_pop },
|
||||
{ "demand", w_Channel_demand },
|
||||
{ "peek", w_Channel_peek },
|
||||
{ "count", w_Channel_count },
|
||||
{ "getCount", w_Channel_getCount },
|
||||
{ "clear", w_Channel_clear },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ int w_Channel_supply(lua_State *L);
|
||||
int w_Channel_pop(lua_State *L);
|
||||
int w_Channel_demand(lua_State *L);
|
||||
int w_Channel_peek(lua_State *L);
|
||||
int w_Channel_count(lua_State *L);
|
||||
int w_Channel_getCount(lua_State *L);
|
||||
int w_Channel_clear(lua_State *L);
|
||||
|
||||
extern "C" int luaopen_channel(lua_State *L);
|
||||
|
||||
Reference in New Issue
Block a user