Cleaned up some ParticleSystem and Quad code

This commit is contained in:
Alex Szpakowski
2013-03-11 17:56:55 -03:00
parent ce71bc0847
commit 4704c4e19e
6 changed files with 10 additions and 10 deletions
@@ -373,7 +373,7 @@ void ParticleSystem::setColor(const std::vector<Color> &newColors)
colors[i] = colorToFloat(newColors[i]);
}
void ParticleSystem::setQuads(const std::vector<love::graphics::Quad *> &newQuads)
void ParticleSystem::setQuads(const std::vector<Quad *> &newQuads)
{
for (size_t i = 0; i < quads.size(); i++)
quads[i]->release();
+3 -3
View File
@@ -27,7 +27,7 @@
#include "common/Vector.h"
#include "graphics/Drawable.h"
#include "graphics/Color.h"
#include "graphics/Quad.h"
#include "Quad.h"
#include "Image.h"
#include <vector>
@@ -300,7 +300,7 @@ public:
* Sets the quads used when drawing the particles.
* @param newQuads Array of quads.
**/
void setQuads(const std::vector<love::graphics::Quad *> &newQuads);
void setQuads(const std::vector<Quad *> &newQuads);
/**
* Removes all quads from the particle system.
@@ -494,7 +494,7 @@ protected:
// Color.
std::vector<Colorf> colors;
std::vector<love::graphics::Quad *> quads;
std::vector<Quad *> quads;
void add();
void remove(particle *p);
@@ -996,7 +996,7 @@ int w_draw(lua_State *L)
int w_drawq(lua_State *L)
{
DrawQable *dq = luax_checktype<DrawQable>(L, 1, "DrawQable", GRAPHICS_DRAWQABLE_T);
Quad *q = luax_checkframe(L, 2);
Quad *q = luax_checkquad(L, 2);
float x = (float)luaL_checknumber(L, 3);
float y = (float)luaL_checknumber(L, 4);
float angle = (float)luaL_optnumber(L, 5, 0);
@@ -278,7 +278,7 @@ int w_ParticleSystem_setQuads(lua_State *L)
return 0;
}
std::vector<love::graphics::Quad *> quads(nQuads);
std::vector<Quad *> quads(nQuads);
if (lua_istable(L, 2))
{
@@ -286,14 +286,14 @@ int w_ParticleSystem_setQuads(lua_State *L)
{
lua_pushnumber(L, i + 1); // array index
lua_gettable(L, 2);
quads[i] = luax_checkframe(L, -1);
quads[i] = luax_checkquad(L, -1);
lua_pop(L, 1);
}
}
else
{
for (int i = 0; i < nQuads; i++)
quads[i] = luax_checkframe(L, i + 2);
quads[i] = luax_checkquad(L, i + 2);
}
t->setQuads(quads);
+1 -1
View File
@@ -28,7 +28,7 @@ namespace graphics
namespace opengl
{
Quad *luax_checkframe(lua_State *L, int idx)
Quad *luax_checkquad(lua_State *L, int idx)
{
return luax_checktype<Quad>(L, idx, "Quad", GRAPHICS_QUAD_T);
}
+1 -1
View File
@@ -32,7 +32,7 @@ namespace graphics
namespace opengl
{
Quad *luax_checkframe(lua_State *L, int idx);
Quad *luax_checkquad(lua_State *L, int idx);
int w_Quad_flip(lua_State *L);
int w_Quad_setViewport(lua_State *L);
int w_Quad_getViewport(lua_State *L);