Alex Szpakowski avatar Alex Szpakowski committed fa3dcf2

Renamed ParticleSystem:count, Channel:count, and all getNum* functions to get*Count (issue #602)

Comments (0)

Files changed (26)

src/modules/audio/Audio.h

 	 * 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.

src/modules/audio/null/Audio.cpp

 	return new Source();
 }
 
-int Audio::getNumSources() const
+int Audio::getSourceCount() const
 {
 	return 0;
 }

src/modules/audio/null/Audio.h

 	// 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();

src/modules/audio/openal/Audio.cpp

 	return new Source(pool, soundData);
 }
 
-int Audio::getNumSources() const
+int Audio::getSourceCount() const
 {
-	return pool->getNumSources();
+	return pool->getSourceCount();
 }
 
 int Audio::getMaxSources() const

src/modules/audio/openal/Audio.h

 	// 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();

src/modules/audio/openal/Pool.cpp

 	}
 }
 
-int Pool::getNumSources() const
+int Pool::getSourceCount() const
 {
 	return playing.size();
 }

src/modules/audio/openal/Pool.h

 
 	void update();
 
-	int getNumSources() const;
+	int getSourceCount() const;
 	int getMaxSources() const;
 
 	bool play(Source *source, ALuint &out);

src/modules/audio/wrap_Audio.cpp

 
 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;
 }
 
 // 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 },

src/modules/audio/wrap_Audio.h

 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);

src/modules/font/ImageRasterizer.cpp

 	}
 }
 
-int ImageRasterizer::getNumGlyphs() const
+int ImageRasterizer::getGlyphCount() const
 {
 	return numglyphs;
 }

src/modules/font/ImageRasterizer.h

 	// 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

src/modules/font/Rasterizer.h

 	/**
 	 * Gets the number of glyphs the rasterizer has data for.
 	 **/
-	virtual int getNumGlyphs() const = 0;
+	virtual int getGlyphCount() const = 0;
 
 
 }; // Rasterizer

src/modules/font/freetype/TrueTypeRasterizer.cpp

 	return glyphData;
 }
 
-int TrueTypeRasterizer::getNumGlyphs() const
+int TrueTypeRasterizer::getGlyphCount() const
 {
 	return face->num_glyphs;
 }

src/modules/font/freetype/TrueTypeRasterizer.h

 	// Implement Rasterizer
 	virtual int getLineHeight() const;
 	virtual GlyphData *getGlyphData(unsigned int glyph) const;
-	virtual int getNumGlyphs() const;
+	virtual int getGlyphCount() const;
 
 private:
 

src/modules/graphics/opengl/ParticleSystem.cpp

 	return ncolors;
 }
 
-int ParticleSystem::count() const
+int ParticleSystem::getCount() const
 {
 	return (int)(pLast - pStart);
 }
 {
 	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();
 
 	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;
 
 	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);

src/modules/graphics/opengl/ParticleSystem.h

 	/**
 	 * Returns the amount of particles that are currently active in the system.
 	 **/
-	int count() const;
+	int getCount() const;
 
 	/**
 	 * Starts/resumes the particle emitter.

src/modules/graphics/opengl/wrap_ParticleSystem.cpp

 	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;
 }
 
 	{ "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 },

src/modules/graphics/opengl/wrap_ParticleSystem.h

 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);

src/modules/joystick/sdl/Joystick.cpp

 	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 *));
 
 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);
 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);
 	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 *));
 
 
 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;
 	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;
 }
 	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);
 	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));
 	if (!verifyJoystick(index))
 		return 0;
 
-	if (ball >= getNumBalls(index))
+	if (ball >= getBallCount(index))
 		return 0;
 
 	int dx, dy;
 	if (!verifyJoystick(index))
 		return false;
 
-	int num = getNumButtons(index);
+	int num = getButtonCount(index);
 
 	for (int button = *buttonlist; button != -1; button = *(++buttonlist))
 	{
 	if (!verifyJoystick(index))
 		return h;
 
-	if (hat >= getNumHats(index))
+	if (hat >= getHatCount(index))
 		return h;
 
 	hats.find(SDL_JoystickGetHat(joysticks[index], hat), h);

src/modules/joystick/sdl/Joystick.h

 
 	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);

src/modules/joystick/sdl/wrap_Joystick.cpp

 	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;
 }
 
 	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;
 }
 
 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 },

src/modules/joystick/sdl/wrap_Joystick.h

 {
 
 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);

src/modules/thread/Channel.cpp

 	return var;
 }
 
-int Channel::count()
+int Channel::getCount()
 {
 	Lock l(mutex);
 	return queue.size();

src/modules/thread/Channel.h

 	Variant *pop();
 	Variant *demand(); // blocking pop
 	Variant *peek();
-	int count();
+	int getCount();
 	void clear();
 
 	void retain();

src/modules/thread/wrap_Channel.cpp

 	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;
 }
 
 	{ "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 }
 };

src/modules/thread/wrap_Channel.h

 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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.