Browse Source

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

rude 16 years ago
parent
commit
a237008ce2

+ 5 - 0
src/modules/graphics/opengl/Graphics.cpp

@@ -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 - 0
src/modules/graphics/opengl/Graphics.h

@@ -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.

+ 10 - 0
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -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 },

+ 1 - 0
src/modules/graphics/opengl/wrap_Graphics.h

@@ -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);

+ 2 - 2
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -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 },

+ 1 - 3
src/scripts/boot.lua

@@ -636,8 +636,8 @@ function love.errhand(msg)
 	love.graphics.setBackgroundColor(89, 157, 220)
 	local font = love.graphics.newFont(love._vera_ttf, 14)
 	love.graphics.setFont(font)
+	
 	love.graphics.setColor(255, 255, 255, 255)
-	if love.audio then love.audio.stop() end	
 
 	local trace = debug.traceback()
 	
@@ -664,8 +664,6 @@ function love.errhand(msg)
 	
 	love.graphics.present()
 		
-	local finish = false
-	
 	while true do
 		e, a, b, c = love.event.wait()
 		

+ 54 - 58
src/scripts/boot.lua.h

@@ -683,68 +683,64 @@ static const unsigned char B1[]={
  97,112,104,105, 99,115, 46,110,101,119, 70,111,110,116, 40,108,111,118,101, 46,
  95,118,101,114, 97, 95,116,116,102, 44, 32, 49, 52, 41, 13, 10,  9,108,111,118,
 101, 46,103,114, 97,112,104,105, 99,115, 46,115,101,116, 70,111,110,116, 40,102,
-111,110,116, 41, 13, 10,  9,108,111,118,101, 46,103,114, 97,112,104,105, 99,115,
- 46,115,101,116, 67,111,108,111,114, 40, 50, 53, 53, 44, 32, 50, 53, 53, 44, 32,
- 50, 53, 53, 44, 32, 50, 53, 53, 41, 13, 10,  9,105,102, 32,108,111,118,101, 46,
- 97,117,100,105,111, 32,116,104,101,110, 32,108,111,118,101, 46, 97,117,100,105,
-111, 46,115,116,111,112, 40, 41, 32,101,110,100,  9, 13, 10, 13, 10,  9,108,111,
- 99, 97,108, 32,116,114, 97, 99,101, 32, 61, 32,100,101, 98,117,103, 46,116,114,
- 97, 99,101, 98, 97, 99,107, 40, 41, 13, 10,  9, 13, 10,  9,108,111,118,101, 46,
-103,114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13, 10,  9, 13,
- 10,  9,108,111, 99, 97,108, 32,101,114,114, 32, 61, 32,123,125, 13, 10,  9, 13,
- 10,  9,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,101,114,114, 44, 32,
- 34, 69,114,114,111,114, 92,110, 34, 41, 13, 10,  9,116, 97, 98,108,101, 46,105,
-110,115,101,114,116, 40,101,114,114, 44, 32,109,115,103, 46, 46, 34, 92,110, 92,
-110, 34, 41, 13, 10,  9, 13, 10,  9,102,111,114, 32,108, 32,105,110, 32,115,116,
-114,105,110,103, 46,103,109, 97,116, 99,104, 40,116,114, 97, 99,101, 44, 32, 34,
- 40, 46, 45, 41, 92,110, 34, 41, 32,100,111, 13, 10,  9,  9,105,102, 32,110,111,
-116, 32,115,116,114,105,110,103, 46,109, 97,116, 99,104, 40,108, 44, 32, 34, 98,
-111,111,116, 46,108,117, 97, 34, 41, 32,116,104,101,110, 13, 10,  9,  9,  9,108,
- 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,108, 44, 32, 34,115,
-116, 97, 99,107, 32,116,114, 97, 99,101, 98, 97, 99,107, 58, 34, 44, 32, 34, 84,
-114, 97, 99,101, 98, 97, 99,107, 92,110, 34, 41, 13, 10,  9,  9,  9,116, 97, 98,
-108,101, 46,105,110,115,101,114,116, 40,101,114,114, 44, 32,108, 41, 13, 10,  9,
-  9,101,110,100, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,108,111, 99, 97,
-108, 32,112, 32, 61, 32,116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40,101,
-114,114, 44, 32, 34, 92,110, 34, 41, 13, 10,  9,  9, 13, 10,  9,112, 32, 61, 32,
-115,116,114,105,110,103, 46,103,115,117, 98, 40,112, 44, 32, 34, 92,116, 34, 44,
- 32, 34, 34, 41, 13, 10,  9,112, 32, 61, 32,115,116,114,105,110,103, 46,103,115,
-117, 98, 40,112, 44, 32, 34, 37, 91,115,116,114,105,110,103, 32, 92, 34, 40, 46,
- 45, 41, 92, 34, 37, 93, 34, 44, 32, 34, 37, 49, 34, 41, 13, 10,  9, 13, 10,  9,
-108,111,118,101, 46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116, 40,
-112, 44, 32, 55, 48, 44, 32, 55, 48, 41,  9, 13, 10,  9, 13, 10,  9,108,111,118,
-101, 46,103,114, 97,112,104,105, 99,115, 46,112,114,101,115,101,110,116, 40, 41,
- 13, 10,  9,  9, 13, 10,  9,108,111, 99, 97,108, 32,102,105,110,105,115,104, 32,
- 61, 32,102, 97,108,115,101, 13, 10,  9, 13, 10,  9,119,104,105,108,101, 32,116,
-114,117,101, 32,100,111, 13, 10,  9,  9,101, 44, 32, 97, 44, 32, 98, 44, 32, 99,
- 32, 61, 32,108,111,118,101, 46,101,118,101,110,116, 46,119, 97,105,116, 40, 41,
- 13, 10,  9,  9, 13, 10,  9,  9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101,
- 46,101,118,101,110,116, 95,113,117,105,116, 32,116,104,101,110, 32,114,101,116,
-117,114,110, 32,101,110,100, 13, 10,  9,  9,105,102, 32,101, 32, 61, 61, 32,108,
-111,118,101, 46,101,118,101,110,116, 95,107,101,121,112,114,101,115,115,101,100,
- 32, 97,110,100, 32, 97, 32, 61, 61, 32,108,111,118,101, 46,107,101,121, 95,101,
-115, 99, 97,112,101, 32,116,104,101,110, 13, 10,  9,  9,  9,114,101,116,117,114,
-110, 13, 10,  9,  9,101,110,100, 13, 10, 13, 10,  9,101,110,100, 13, 10,  9, 13,
- 10,101,110,100, 13, 10, 13, 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+111,110,116, 41, 13, 10,  9, 13, 10,  9,108,111,118,101, 46,103,114, 97,112,104,
+105, 99,115, 46,115,101,116, 67,111,108,111,114, 40, 50, 53, 53, 44, 32, 50, 53,
+ 53, 44, 32, 50, 53, 53, 44, 32, 50, 53, 53, 41, 13, 10, 13, 10,  9,108,111, 99,
+ 97,108, 32,116,114, 97, 99,101, 32, 61, 32,100,101, 98,117,103, 46,116,114, 97,
+ 99,101, 98, 97, 99,107, 40, 41, 13, 10,  9, 13, 10,  9,108,111,118,101, 46,103,
+114, 97,112,104,105, 99,115, 46, 99,108,101, 97,114, 40, 41, 13, 10,  9, 13, 10,
+  9,108,111, 99, 97,108, 32,101,114,114, 32, 61, 32,123,125, 13, 10,  9, 13, 10,
+  9,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,101,114,114, 44, 32, 34,
+ 69,114,114,111,114, 92,110, 34, 41, 13, 10,  9,116, 97, 98,108,101, 46,105,110,
+115,101,114,116, 40,101,114,114, 44, 32,109,115,103, 46, 46, 34, 92,110, 92,110,
+ 34, 41, 13, 10,  9, 13, 10,  9,102,111,114, 32,108, 32,105,110, 32,115,116,114,
+105,110,103, 46,103,109, 97,116, 99,104, 40,116,114, 97, 99,101, 44, 32, 34, 40,
+ 46, 45, 41, 92,110, 34, 41, 32,100,111, 13, 10,  9,  9,105,102, 32,110,111,116,
+ 32,115,116,114,105,110,103, 46,109, 97,116, 99,104, 40,108, 44, 32, 34, 98,111,
+111,116, 46,108,117, 97, 34, 41, 32,116,104,101,110, 13, 10,  9,  9,  9,108, 32,
+ 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,108, 44, 32, 34,115,116,
+ 97, 99,107, 32,116,114, 97, 99,101, 98, 97, 99,107, 58, 34, 44, 32, 34, 84,114,
+ 97, 99,101, 98, 97, 99,107, 92,110, 34, 41, 13, 10,  9,  9,  9,116, 97, 98,108,
+101, 46,105,110,115,101,114,116, 40,101,114,114, 44, 32,108, 41, 13, 10,  9,  9,
+101,110,100, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,108,111, 99, 97,108,
+ 32,112, 32, 61, 32,116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40,101,114,
+114, 44, 32, 34, 92,110, 34, 41, 13, 10,  9,  9, 13, 10,  9,112, 32, 61, 32,115,
+116,114,105,110,103, 46,103,115,117, 98, 40,112, 44, 32, 34, 92,116, 34, 44, 32,
+ 34, 34, 41, 13, 10,  9,112, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
+ 98, 40,112, 44, 32, 34, 37, 91,115,116,114,105,110,103, 32, 92, 34, 40, 46, 45,
+ 41, 92, 34, 37, 93, 34, 44, 32, 34, 37, 49, 34, 41, 13, 10,  9, 13, 10,  9,108,
+111,118,101, 46,103,114, 97,112,104,105, 99,115, 46,112,114,105,110,116, 40,112,
+ 44, 32, 55, 48, 44, 32, 55, 48, 41,  9, 13, 10,  9, 13, 10,  9,108,111,118,101,
+ 46,103,114, 97,112,104,105, 99,115, 46,112,114,101,115,101,110,116, 40, 41, 13,
+ 10,  9,  9, 13, 10,  9,119,104,105,108,101, 32,116,114,117,101, 32,100,111, 13,
+ 10,  9,  9,101, 44, 32, 97, 44, 32, 98, 44, 32, 99, 32, 61, 32,108,111,118,101,
+ 46,101,118,101,110,116, 46,119, 97,105,116, 40, 41, 13, 10,  9,  9, 13, 10,  9,
+  9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101,110,116, 95,
+113,117,105,116, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,101,110,100,
+ 13, 10,  9,  9,105,102, 32,101, 32, 61, 61, 32,108,111,118,101, 46,101,118,101,
+110,116, 95,107,101,121,112,114,101,115,115,101,100, 32, 97,110,100, 32, 97, 32,
+ 61, 61, 32,108,111,118,101, 46,107,101,121, 95,101,115, 99, 97,112,101, 32,116,
+104,101,110, 13, 10,  9,  9,  9,114,101,116,117,114,110, 13, 10,  9,  9,101,110,
+100, 13, 10, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,101,110,100, 13, 10, 13,
+ 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 45, 45, 32, 84,104,101, 32,114,111,
-111,116, 32,111,102, 32, 97,108,108, 32, 99, 97,108,108,115, 46, 13, 10, 45, 45,
+ 45, 45, 13, 10, 45, 45, 32, 84,104,101, 32,114,111,111,116, 32,111,102, 32, 97,
+108,108, 32, 99, 97,108,108,115, 46, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
  45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 13,
- 10,102,117,110, 99,116,105,111,110, 32,101,114,114,111,114, 95,112,114,105,110,
-116,101,114, 40,109,115,103, 41, 13, 10,  9,112,114,105,110,116, 40, 34, 98,111,
-111,116, 34, 44, 32,109,115,103, 44, 32,100,101, 98,117,103, 46,116,114, 97, 99,
-101, 98, 97, 99,107, 40, 41, 41, 13, 10,101,110,100, 13, 10, 13, 10,114,101,115,
-117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101, 46, 98,111,
-111,116, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114, 41, 13, 10,
-114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101,
- 46,105,110,105,116, 44, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114,
- 41, 13, 10,114,101,115,117,108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,
-111,118,101, 46,114,117,110, 44, 32,108,111,118,101, 46,101,114,114,104, 97,110,
-100, 41, 13, 10, 13, 10,112,114,105,110,116, 40, 34, 68,111,110,101, 46, 34, 41,
-
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 13, 10, 13, 10,102,117,110, 99,116,105,
+111,110, 32,101,114,114,111,114, 95,112,114,105,110,116,101,114, 40,109,115,103,
+ 41, 13, 10,  9,112,114,105,110,116, 40, 34, 98,111,111,116, 34, 44, 32,109,115,
+103, 44, 32,100,101, 98,117,103, 46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41,
+ 41, 13, 10,101,110,100, 13, 10, 13, 10,114,101,115,117,108,116, 32, 61, 32,120,
+112, 99, 97,108,108, 40,108,111,118,101, 46, 98,111,111,116, 44, 32,101,114,114,
+111,114, 95,112,114,105,110,116,101,114, 41, 13, 10,114,101,115,117,108,116, 32,
+ 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101, 46,105,110,105,116, 44, 32,
+101,114,114,111,114, 95,112,114,105,110,116,101,114, 41, 13, 10,114,101,115,117,
+108,116, 32, 61, 32,120,112, 99, 97,108,108, 40,108,111,118,101, 46,114,117,110,
+ 44, 32,108,111,118,101, 46,101,114,114,104, 97,110,100, 41, 13, 10, 13, 10,112,
+114,105,110,116, 40, 34, 68,111,110,101, 46, 34, 41,
 };
 
  if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"boot.lua")==0) lua_call(L, 0, 0);