ParticleSystem works now. Error handler no longer loops forever. :)

This commit is contained in:
rude
2009-08-27 00:48:08 +02:00
parent 37745bf745
commit a237008ce2
7 changed files with 76 additions and 63 deletions
+5
View File
@@ -438,6 +438,11 @@ namespace opengl
return new SpriteBatch(image, size, usage);
}
ParticleSystem * Graphics::newParticleSystem(Image * image, int size)
{
return new ParticleSystem(image, size);
}
void Graphics::setColor(Color c)
{
glColor4ubv(&c.r);
+3
View File
@@ -38,6 +38,7 @@
#include "ImageFont.h"
#include "Quad.h"
#include "SpriteBatch.h"
#include "ParticleSystem.h"
namespace love
{
@@ -252,6 +253,8 @@ namespace opengl
Font * newImageFont(Image * image, const char * glyphs, float spacing = 1);
SpriteBatch * newSpriteBatch(Image * image, int size, int usage);
ParticleSystem * newParticleSystem(Image * image, int size);
/**
* Sets the foreground color.
@@ -254,6 +254,15 @@ namespace opengl
return 1;
}
int w_newParticleSystem(lua_State * L)
{
Image * image = luax_checktype<Image>(L, 1, "Image", GRAPHICS_IMAGE_T);
int size = luaL_checkint(L, 2);
ParticleSystem * t = instance->newParticleSystem(image, size);
luax_newtype(L, "ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_T, (void*)t);
return 1;
}
int w_setColor(lua_State * L)
{
Color c;
@@ -686,6 +695,7 @@ namespace opengl
{ "newFont", w_newFont },
{ "newImageFont", w_newImageFont },
{ "newSpriteBatch", w_newSpriteBatch },
{ "newParticleSystem", w_newParticleSystem },
{ "setColor", w_setColor },
{ "getColor", w_getColor },
@@ -55,6 +55,7 @@ namespace opengl
int w_newFont(lua_State * L);
int w_newImageFont(lua_State * L);
int w_newSpriteBatch(lua_State * L);
int w_newParticleSystem(lua_State * L);
int w_setColor(lua_State * L);
int w_getColor(lua_State * L);
int w_setBackgroundColor(lua_State * L);
@@ -69,7 +69,7 @@ namespace opengl
{
ParticleSystem * t = luax_checkparticlesystem(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
float arg2 = (float)luaL_checknumber(L, 3);
float arg2 = (float)luaL_optnumber(L, 3, arg1);
t->setParticleLife(arg1, arg2);
return 0;
}
@@ -310,7 +310,7 @@ namespace opengl
{ "setSprite", w_ParticleSystem_setSprite },
{ "setBufferSize", w_ParticleSystem_setBufferSize },
{ "setEmissionRate", w_ParticleSystem_setEmissionRate },
{ "setLifeTime", w_ParticleSystem_setLifetime },
{ "setLifetime", w_ParticleSystem_setLifetime },
{ "setParticleLife", w_ParticleSystem_setParticleLife },
{ "setPosition", w_ParticleSystem_setPosition },
{ "setDirection", w_ParticleSystem_setDirection },