Added ParticleSystem:isPaused (issue #623) and removed ParticleSystem:isEmpty/isFull (issue #621)

This commit is contained in:
Alex Szpakowski
2013-05-23 13:42:29 -03:00
parent 0e9d73503c
commit 0c58d5d46a
5 changed files with 17 additions and 13 deletions
@@ -573,6 +573,11 @@ bool ParticleSystem::isActive() const
return active;
}
bool ParticleSystem::isPaused() const
{
return !active && life < lifetime;
}
bool ParticleSystem::isEmpty() const
{
return pStart == pLast;
@@ -468,6 +468,11 @@ public:
**/
bool isActive() const;
/**
* Returns whether the particle emitter is paused.
**/
bool isPaused() const;
/**
* Returns whether the particle system is empty of particles or not.
**/
@@ -579,17 +579,10 @@ int w_ParticleSystem_isActive(lua_State *L)
return 1;
}
int w_ParticleSystem_isEmpty(lua_State *L)
int w_ParticleSystem_isPaused(lua_State *L)
{
ParticleSystem *t = luax_checkparticlesystem(L, 1);
luax_pushboolean(L, t->isEmpty());
return 1;
}
int w_ParticleSystem_isFull(lua_State *L)
{
ParticleSystem *t = luax_checkparticlesystem(L, 1);
luax_pushboolean(L, t->isFull());
luax_pushboolean(L, t->isPaused());
return 1;
}
@@ -654,8 +647,7 @@ static const luaL_Reg functions[] =
{ "reset", w_ParticleSystem_reset },
{ "emit", w_ParticleSystem_emit },
{ "isActive", w_ParticleSystem_isActive },
{ "isEmpty", w_ParticleSystem_isEmpty },
{ "isFull", w_ParticleSystem_isFull },
{ "isPaused", w_ParticleSystem_isPaused },
{ "update", w_ParticleSystem_update },
{ 0, 0 }
};
@@ -85,8 +85,7 @@ int w_ParticleSystem_pause(lua_State *L);
int w_ParticleSystem_reset(lua_State *L);
int w_ParticleSystem_emit(lua_State *L);
int w_ParticleSystem_isActive(lua_State *L);
int w_ParticleSystem_isEmpty(lua_State *L);
int w_ParticleSystem_isFull(lua_State *L);
int w_ParticleSystem_isPaused(lua_State *L);
int w_ParticleSystem_update(lua_State *L);
extern "C" int luaopen_particlesystem(lua_State *L);