Mercurial > love-experiments
diff src/modules/graphics/opengl/wrap_ParticleSystem.cpp @ 1352:470a47bebfb3 particlesystem-quads
Added ParticleSystem:setQuads(q1, q2, ...), quads are chosen based on current particle lifetime in a similar style to ParticleSystem:setColors
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Sun, 10 Mar 2013 03:40:25 -0300 |
| parents | b7f097053d74 |
| children | c3c9d6ed3e21 |
line wrap: on
line diff
--- a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp Thu Mar 07 17:47:40 2013 -0400 +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp Sun Mar 10 03:40:25 2013 -0300 @@ -19,6 +19,7 @@ **/ #include "wrap_ParticleSystem.h" +#include "wrap_Quad.h" #include "common/Vector.h" @@ -262,6 +263,32 @@ return 0; } +int w_ParticleSystem_setQuads(lua_State *L) +{ + ParticleSystem *t = luax_checkparticlesystem(L, 1); + int nQuads = lua_gettop(L) - 1; + + if (nQuads == 0) + t->setQuad(); + else if (nQuads == 1) + { + love::graphics::Quad *q = luax_checkframe(L, 2); + t->setQuad(q); + } + else + { + std::vector<love::graphics::Quad *> quads(nQuads); + for (size_t i = 0; i < nQuads; i++) + { + love::graphics::Quad *q = luax_checkframe(L, i + 2); + quads[i] = q; + } + t->setQuad(quads); + } + + return 0; +} + int w_ParticleSystem_setOffset(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); @@ -423,6 +450,7 @@ { "setSpin", w_ParticleSystem_setSpin }, { "setSpinVariation", w_ParticleSystem_setSpinVariation }, { "setColors", w_ParticleSystem_setColors }, + { "setQuads", w_ParticleSystem_setQuads }, { "setOffset", w_ParticleSystem_setOffset }, { "getX", w_ParticleSystem_getX }, { "getY", w_ParticleSystem_getY },
