From 0c58d5d46a915a976a1009db35ee4de42e8e8a36 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 23 May 2013 13:42:29 -0300 Subject: [PATCH] Added ParticleSystem:isPaused (issue #623) and removed ParticleSystem:isEmpty/isFull (issue #621) --- changes.txt | 3 +++ src/modules/graphics/opengl/ParticleSystem.cpp | 5 +++++ src/modules/graphics/opengl/ParticleSystem.h | 5 +++++ .../graphics/opengl/wrap_ParticleSystem.cpp | 14 +++----------- src/modules/graphics/opengl/wrap_ParticleSystem.h | 3 +-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/changes.txt b/changes.txt index 8d02533d6..998606fcc 100644 --- a/changes.txt +++ b/changes.txt @@ -105,6 +105,7 @@ LOVE 0.9.0 [] * Removed love.graphics.setColorMode. * Removed love.graphics.newStencil. * Removed Quad objects (replaced by Geometry). + * Removed ParticleSystem:isFull/isEmpty. * Removed love.joystick.open and friends. * Removed thread names. * Removed old thread messaging api (see Channels). @@ -124,8 +125,10 @@ LOVE 0.9.0 [] * Updated love.graphics.newScreenshot to create a fully opaque image by default. * Updated error messages when sending bad values to Shaders. * Updated love.graphics.newParticleSystem to have a default buffer size of 1000. + * Updated love.image.newImageData and love.graphics.newImage to accept FileData. * Updated ImageData:setPixel to accept a table and default to 255 alpha. * Updated love.image memory handling, improves errors and thread-safety. + * Updated love.audio.newSource and love.sound.newDecoder/newSoundData to accept FileData. * Updated allocation for SoundData, it's more efficient and less wasteful. * Updated Source:set* functions to default z to 0. * Updated love.timer.getFPS to be microsecond-accurate. diff --git a/src/modules/graphics/opengl/ParticleSystem.cpp b/src/modules/graphics/opengl/ParticleSystem.cpp index 9620f188e..a9b1872db 100644 --- a/src/modules/graphics/opengl/ParticleSystem.cpp +++ b/src/modules/graphics/opengl/ParticleSystem.cpp @@ -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; diff --git a/src/modules/graphics/opengl/ParticleSystem.h b/src/modules/graphics/opengl/ParticleSystem.h index f0d9afa45..1e45b0d4b 100644 --- a/src/modules/graphics/opengl/ParticleSystem.h +++ b/src/modules/graphics/opengl/ParticleSystem.h @@ -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. **/ diff --git a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp index 4a23dfecc..e29519f31 100644 --- a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp @@ -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 } }; diff --git a/src/modules/graphics/opengl/wrap_ParticleSystem.h b/src/modules/graphics/opengl/wrap_ParticleSystem.h index 4bcc30359..c90f9471c 100644 --- a/src/modules/graphics/opengl/wrap_ParticleSystem.h +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.h @@ -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);