From 4c616e409b4ebf4ec202e68dbdcca4976837289e Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 3 May 2013 04:04:44 -0300 Subject: [PATCH] Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602) --- src/modules/audio/Audio.h | 2 +- src/modules/audio/null/Audio.cpp | 2 +- src/modules/audio/null/Audio.h | 2 +- src/modules/audio/openal/Audio.cpp | 4 +-- src/modules/audio/openal/Audio.h | 2 +- src/modules/audio/openal/Pool.cpp | 2 +- src/modules/audio/openal/Pool.h | 2 +- src/modules/audio/wrap_Audio.cpp | 6 ++-- src/modules/audio/wrap_Audio.h | 2 +- src/modules/font/ImageRasterizer.cpp | 2 +- src/modules/font/ImageRasterizer.h | 2 +- src/modules/font/Rasterizer.h | 2 +- .../font/freetype/TrueTypeRasterizer.cpp | 2 +- .../font/freetype/TrueTypeRasterizer.h | 2 +- .../graphics/opengl/ParticleSystem.cpp | 10 +++---- src/modules/graphics/opengl/ParticleSystem.h | 2 +- .../graphics/opengl/wrap_ParticleSystem.cpp | 6 ++-- .../graphics/opengl/wrap_ParticleSystem.h | 2 +- src/modules/joystick/sdl/Joystick.cpp | 30 +++++++++---------- src/modules/joystick/sdl/Joystick.h | 10 +++---- src/modules/joystick/sdl/wrap_Joystick.cpp | 30 +++++++++---------- src/modules/joystick/sdl/wrap_Joystick.h | 10 +++---- src/modules/thread/Channel.cpp | 2 +- src/modules/thread/Channel.h | 2 +- src/modules/thread/wrap_Channel.cpp | 6 ++-- src/modules/thread/wrap_Channel.h | 2 +- 26 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/modules/audio/Audio.h b/src/modules/audio/Audio.h index bc0feaf7d..74d71885a 100644 --- a/src/modules/audio/Audio.h +++ b/src/modules/audio/Audio.h @@ -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. diff --git a/src/modules/audio/null/Audio.cpp b/src/modules/audio/null/Audio.cpp index 3f79409c5..a96125ab8 100644 --- a/src/modules/audio/null/Audio.cpp +++ b/src/modules/audio/null/Audio.cpp @@ -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; } diff --git a/src/modules/audio/null/Audio.h b/src/modules/audio/null/Audio.h index 374b88017..dcd56709c 100644 --- a/src/modules/audio/null/Audio.h +++ b/src/modules/audio/null/Audio.h @@ -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(); diff --git a/src/modules/audio/openal/Audio.cpp b/src/modules/audio/openal/Audio.cpp index aa32410df..645f61e1d 100644 --- a/src/modules/audio/openal/Audio.cpp +++ b/src/modules/audio/openal/Audio.cpp @@ -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 diff --git a/src/modules/audio/openal/Audio.h b/src/modules/audio/openal/Audio.h index e4febe87f..1bb0389f8 100644 --- a/src/modules/audio/openal/Audio.h +++ b/src/modules/audio/openal/Audio.h @@ -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(); diff --git a/src/modules/audio/openal/Pool.cpp b/src/modules/audio/openal/Pool.cpp index 28eeccaf5..cddb10edc 100644 --- a/src/modules/audio/openal/Pool.cpp +++ b/src/modules/audio/openal/Pool.cpp @@ -106,7 +106,7 @@ void Pool::update() } } -int Pool::getNumSources() const +int Pool::getSourceCount() const { return playing.size(); } diff --git a/src/modules/audio/openal/Pool.h b/src/modules/audio/openal/Pool.h index fce12ecbc..74244e54c 100644 --- a/src/modules/audio/openal/Pool.h +++ b/src/modules/audio/openal/Pool.h @@ -71,7 +71,7 @@ public: void update(); - int getNumSources() const; + int getSourceCount() const; int getMaxSources() const; bool play(Source *source, ALuint &out); diff --git a/src/modules/audio/wrap_Audio.cpp b/src/modules/audio/wrap_Audio.cpp index 5234f757c..71f9a92bc 100644 --- a/src/modules/audio/wrap_Audio.cpp +++ b/src/modules/audio/wrap_Audio.cpp @@ -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 }, diff --git a/src/modules/audio/wrap_Audio.h b/src/modules/audio/wrap_Audio.h index 01d45e817..674ecc161 100644 --- a/src/modules/audio/wrap_Audio.h +++ b/src/modules/audio/wrap_Audio.h @@ -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); diff --git a/src/modules/font/ImageRasterizer.cpp b/src/modules/font/ImageRasterizer.cpp index 007b4984c..5773b271a 100644 --- a/src/modules/font/ImageRasterizer.cpp +++ b/src/modules/font/ImageRasterizer.cpp @@ -146,7 +146,7 @@ void ImageRasterizer::load() } } -int ImageRasterizer::getNumGlyphs() const +int ImageRasterizer::getGlyphCount() const { return numglyphs; } diff --git a/src/modules/font/ImageRasterizer.h b/src/modules/font/ImageRasterizer.h index c4b4ff438..863e54ff6 100644 --- a/src/modules/font/ImageRasterizer.h +++ b/src/modules/font/ImageRasterizer.h @@ -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 diff --git a/src/modules/font/Rasterizer.h b/src/modules/font/Rasterizer.h index 5853ccd48..a51435a2c 100644 --- a/src/modules/font/Rasterizer.h +++ b/src/modules/font/Rasterizer.h @@ -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 diff --git a/src/modules/font/freetype/TrueTypeRasterizer.cpp b/src/modules/font/freetype/TrueTypeRasterizer.cpp index 3c8ec3740..c457bfaa1 100644 --- a/src/modules/font/freetype/TrueTypeRasterizer.cpp +++ b/src/modules/font/freetype/TrueTypeRasterizer.cpp @@ -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; } diff --git a/src/modules/font/freetype/TrueTypeRasterizer.h b/src/modules/font/freetype/TrueTypeRasterizer.h index 848bb4321..3efd2ad65 100644 --- a/src/modules/font/freetype/TrueTypeRasterizer.h +++ b/src/modules/font/freetype/TrueTypeRasterizer.h @@ -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: diff --git a/src/modules/graphics/opengl/ParticleSystem.cpp b/src/modules/graphics/opengl/ParticleSystem.cpp index b9c05b2eb..be6533b3b 100644 --- a/src/modules/graphics/opengl/ParticleSystem.cpp +++ b/src/modules/graphics/opengl/ParticleSystem.cpp @@ -525,7 +525,7 @@ std::vector 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); diff --git a/src/modules/graphics/opengl/ParticleSystem.h b/src/modules/graphics/opengl/ParticleSystem.h index 330126043..c4a6d9a70 100644 --- a/src/modules/graphics/opengl/ParticleSystem.h +++ b/src/modules/graphics/opengl/ParticleSystem.h @@ -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. diff --git a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp index 8cb8367dc..65d30a6ba 100644 --- a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp @@ -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 }, diff --git a/src/modules/graphics/opengl/wrap_ParticleSystem.h b/src/modules/graphics/opengl/wrap_ParticleSystem.h index d1eb45fcd..e4d36a97a 100644 --- a/src/modules/graphics/opengl/wrap_ParticleSystem.h +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.h @@ -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); diff --git a/src/modules/joystick/sdl/Joystick.cpp b/src/modules/joystick/sdl/Joystick.cpp index b6f6d56ef..60efed5a9 100644 --- a/src/modules/joystick/sdl/Joystick.cpp +++ b/src/modules/joystick/sdl/Joystick.cpp @@ -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= 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); diff --git a/src/modules/joystick/sdl/Joystick.h b/src/modules/joystick/sdl/Joystick.h index 1604c5129..ef64ca6c6 100644 --- a/src/modules/joystick/sdl/Joystick.h +++ b/src/modules/joystick/sdl/Joystick.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); diff --git a/src/modules/joystick/sdl/wrap_Joystick.cpp b/src/modules/joystick/sdl/wrap_Joystick.cpp index 646709e83..8bbf2ee86 100644 --- a/src/modules/joystick/sdl/wrap_Joystick.cpp +++ b/src/modules/joystick/sdl/wrap_Joystick.cpp @@ -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 }, diff --git a/src/modules/joystick/sdl/wrap_Joystick.h b/src/modules/joystick/sdl/wrap_Joystick.h index f49c11fe9..ed3db62a7 100644 --- a/src/modules/joystick/sdl/wrap_Joystick.h +++ b/src/modules/joystick/sdl/wrap_Joystick.h @@ -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); diff --git a/src/modules/thread/Channel.cpp b/src/modules/thread/Channel.cpp index 09c90ba04..e26facb4a 100644 --- a/src/modules/thread/Channel.cpp +++ b/src/modules/thread/Channel.cpp @@ -176,7 +176,7 @@ Variant *Channel::peek() return var; } -int Channel::count() +int Channel::getCount() { Lock l(mutex); return queue.size(); diff --git a/src/modules/thread/Channel.h b/src/modules/thread/Channel.h index 2f49e6234..110bc3a9d 100644 --- a/src/modules/thread/Channel.h +++ b/src/modules/thread/Channel.h @@ -49,7 +49,7 @@ public: Variant *pop(); Variant *demand(); // blocking pop Variant *peek(); - int count(); + int getCount(); void clear(); void retain(); diff --git a/src/modules/thread/wrap_Channel.cpp b/src/modules/thread/wrap_Channel.cpp index bedaf6456..9cf5f6f8f 100644 --- a/src/modules/thread/wrap_Channel.cpp +++ b/src/modules/thread/wrap_Channel.cpp @@ -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 } }; diff --git a/src/modules/thread/wrap_Channel.h b/src/modules/thread/wrap_Channel.h index 283cbce9f..5b46d1b01 100644 --- a/src/modules/thread/wrap_Channel.h +++ b/src/modules/thread/wrap_Channel.h @@ -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);