Browse Source

Made error screen and reverted love.event.wait.

rude 16 years ago
parent
commit
ab981ea982

+ 8 - 16
src/modules/event/sdl/Event.cpp

@@ -44,8 +44,14 @@ namespace sdl
 
 
 	int Event::wait(lua_State * L)
 	int Event::wait(lua_State * L)
 	{
 	{
-		lua_pushcclosure(L, &wait_i, 0);
-		return 1;
+		SDL_EnableUNICODE(1);
+
+		// The union used to get SDL events. 
+		static SDL_Event e;
+
+		SDL_WaitEvent(&e);
+
+		return Event::pushEvent(L, e);
 	}
 	}
 
 
 	void Event::quit()
 	void Event::quit()
@@ -82,20 +88,6 @@ namespace sdl
 		return 0;
 		return 0;
 	}
 	}
 
 
-	int Event::wait_i(lua_State * L)
-	{
-		SDL_EnableUNICODE(1);
-
-		// The union used to get SDL events. 
-		static SDL_Event e;
-
-		SDL_WaitEvent(&e);
-
-		int args = Event::pushEvent(L, e);
-
-		return args;
-	}
-
 	int Event::pushEvent(lua_State * L, SDL_Event & e)
 	int Event::pushEvent(lua_State * L, SDL_Event & e)
 	{
 	{
 		switch(e.type)
 		switch(e.type)

+ 0 - 2
src/modules/event/sdl/Event.h

@@ -76,8 +76,6 @@ namespace sdl
 		* The iterator function.
 		* The iterator function.
 		**/
 		**/
 		static int poll_i(lua_State * L);
 		static int poll_i(lua_State * L);
-		static int wait_i(lua_State * L);
-
 	private:
 	private:
 
 
 		static int pushEvent(lua_State * L, SDL_Event & e);
 		static int pushEvent(lua_State * L, SDL_Event & e);

+ 2 - 0
src/modules/physics/box2d/Contact.h

@@ -24,6 +24,7 @@
 // LOVE
 // LOVE
 #include <common/Object.h>
 #include <common/Object.h>
 #include <common/runtime.h>
 #include <common/runtime.h>
+#include "World.h"
 
 
 // Box2D
 // Box2D
 #include "Include/Box2D.h"
 #include "Include/Box2D.h"
@@ -44,6 +45,7 @@ namespace box2d
 	{
 	{
 		// Friends.
 		// Friends.
 		friend class World;
 		friend class World;
+		friend class World::ContactCallback;
 
 
 	private:
 	private:
 
 

+ 26 - 15
src/scripts/boot.lua

@@ -615,7 +615,7 @@ function love.nogame()
 	end
 	end
 	
 	
 	love.conf = function(t)
 	love.conf = function(t)
-		t.title = "*Tank* you using LOVE " .. love._version_string .. " (" .. love._version_codename .. ")"
+		t.title = "*Tank* you for using LOVE " .. love._version_string .. " (" .. love._version_codename .. ")"
 		t.modules.audio = false
 		t.modules.audio = false
 		t.modules.sound = false
 		t.modules.sound = false
 		t.modules.physics = false
 		t.modules.physics = false
@@ -642,27 +642,38 @@ function love.errhand(msg)
 	local trace = debug.traceback()
 	local trace = debug.traceback()
 	
 	
 	love.graphics.clear()
 	love.graphics.clear()
-	love.graphics.print(msg, 70, 80)
-	--love.graphics.print(, 70, 160)
-	local y, yi = 160, 20
-	local x, xi = 70, 10
-	for line in string.gmatch(trace, ".-\n") do
-		love.graphics.print(line, x, y)
-		y = y + yi
-		x = x + xi
+	
+	local err = {}
+	
+	table.insert(err, "Error\n")
+	table.insert(err, msg.."\n\n")
+	
+	for l in string.gmatch(trace, "(.-)\n") do
+		if not string.match(l, "boot.lua") then
+			l = string.gsub(l, "stack traceback:", "Traceback\n")
+			table.insert(err, l)
+		end
 	end
 	end
 	
 	
+	local p = table.concat(err, "\n")
+		
+	p = string.gsub(p, "\t", "")
+	p = string.gsub(p, "%[string \"(.-)\"%]", "%1")
+	
+	love.graphics.print(p, 70, 70)	
 	
 	
 	love.graphics.present()
 	love.graphics.present()
-
+		
+	local finish = false
 	
 	
 	while true do
 	while true do
-	
-		-- Process events.
-		for e,a,b,c in love.event.wait() do
-			if e == love.event_quit then return end
-		end
+		e, a, b, c = love.event.wait()
 		
 		
+		if e == love.event_quit then return end
+		if e == love.event_keypressed and a == love.key_escape then
+			return
+		end
+
 	end
 	end
 	
 	
 end
 end

+ 83 - 35
src/scripts/boot.lua.h

@@ -654,49 +654,97 @@ static const unsigned char B1[]={
  13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,108,111,118,101, 46, 99,111,110,
  13, 10,  9,101,110,100, 13, 10,  9, 13, 10,  9,108,111,118,101, 46, 99,111,110,
 102, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,116, 41, 13, 10,  9,  9,116,
 102, 32, 61, 32,102,117,110, 99,116,105,111,110, 40,116, 41, 13, 10,  9,  9,116,
  46,116,105,116,108,101, 32, 61, 32, 34, 42, 84, 97,110,107, 42, 32,121,111,117,
  46,116,105,116,108,101, 32, 61, 32, 34, 42, 84, 97,110,107, 42, 32,121,111,117,
- 32,117,115,105,110,103, 32, 76, 79, 86, 69, 32, 34, 32, 46, 46, 32,108,111,118,
-101, 46, 95,118,101,114,115,105,111,110, 95,115,116,114,105,110,103, 32, 46, 46,
- 32, 34, 32, 40, 34, 32, 46, 46, 32,108,111,118,101, 46, 95,118,101,114,115,105,
-111,110, 95, 99,111,100,101,110, 97,109,101, 32, 46, 46, 32, 34, 41, 34, 13, 10,
-  9,  9,116, 46,109,111,100,117,108,101,115, 46, 97,117,100,105,111, 32, 61, 32,
-102, 97,108,115,101, 13, 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46,115,
-111,117,110,100, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,  9,116, 46,109,111,
-100,117,108,101,115, 46,112,104,121,115,105, 99,115, 32, 61, 32,102, 97,108,115,
-101, 13, 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46,106,111,121,115,116,
-105, 99,107, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,  9,116, 46,109,111,100,
-117,108,101,115, 46,110, 97,116,105,118,101, 32, 61, 32,102, 97,108,115,101, 13,
- 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46,102,111,110,116, 32, 61, 32,
-102, 97,108,115,101, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,101,110,100, 13,
- 10, 13, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 32,102,111,114, 32,117,115,105,110,103, 32, 76, 79, 86, 69, 32, 34, 32, 46, 46,
+ 32,108,111,118,101, 46, 95,118,101,114,115,105,111,110, 95,115,116,114,105,110,
+103, 32, 46, 46, 32, 34, 32, 40, 34, 32, 46, 46, 32,108,111,118,101, 46, 95,118,
+101,114,115,105,111,110, 95, 99,111,100,101,110, 97,109,101, 32, 46, 46, 32, 34,
+ 41, 34, 13, 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46, 97,117,100,105,
+111, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,  9,116, 46,109,111,100,117,108,
+101,115, 46,115,111,117,110,100, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,  9,
+116, 46,109,111,100,117,108,101,115, 46,112,104,121,115,105, 99,115, 32, 61, 32,
+102, 97,108,115,101, 13, 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46,106,
+111,121,115,116,105, 99,107, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,  9,116,
+ 46,109,111,100,117,108,101,115, 46,110, 97,116,105,118,101, 32, 61, 32,102, 97,
+108,115,101, 13, 10,  9,  9,116, 46,109,111,100,117,108,101,115, 46,102,111,110,
+116, 32, 61, 32,102, 97,108,115,101, 13, 10,  9,101,110,100, 13, 10,  9, 13, 10,
+101,110,100, 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, 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, 69,114,114,111,114, 32,115, 99,114,101,101,110, 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, 13, 10, 45, 45, 32, 69,114,114,111,114, 32,115, 99,114,
+101,101,110, 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, 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,108,111,118,101, 46,101,
-114,114,111,114,115, 99,114,101,101,110, 40, 41, 13, 10,  9, 13, 10,  9, 45, 45,
- 32, 77, 97,105,110, 32,108,111,111,112, 32,103,111,101,115, 32,104,101,114,101,
- 46, 13, 10, 13, 10,101,110,100, 13, 10, 13, 10, 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,108,111,
+118,101, 46,101,114,114,104, 97,110,100, 40,109,115,103, 41, 13, 10, 13, 10,  9,
+ 45, 45, 32, 76,111, 97,100, 46, 13, 10,  9,108,111,118,101, 46,103,114, 97,112,
+104,105, 99,115, 46,115,101,116, 66, 97, 99,107,103,114,111,117,110,100, 67,111,
+108,111,114, 40, 56, 57, 44, 32, 49, 53, 55, 44, 32, 50, 50, 48, 41, 13, 10,  9,
+108,111, 99, 97,108, 32,102,111,110,116, 32, 61, 32,108,111,118,101, 46,103,114,
+ 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,
  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, 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, 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, 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, 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,101,114,114,111,114, 95,112,114,105,
-110,116,101,114, 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, 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);
  if (luaL_loadbuffer(L,(const char*)B1,sizeof(B1),"boot.lua")==0) lua_call(L, 0, 0);