diff --git a/Engine.cc b/Engine.cc
index 533cd25..bbc19b2 100644
--- a/Engine.cc
+++ b/Engine.cc
@@ -529,6 +529,15 @@ void Engine::callList(GLuint list)
glCallList(list);
}
+void Engine::clearWorld()
+{
+ while (!m_objects.empty())
+ {
+ std::map::iterator it = m_objects.begin();
+ removeObject(it->first);
+ }
+}
+
void Engine::debug_hook(lua_Debug * debug)
{
Uint32 ticks = SDL_GetTicks();
diff --git a/Engine.h b/Engine.h
index 6e6d717..349075f 100644
--- a/Engine.h
+++ b/Engine.h
@@ -154,6 +154,7 @@ class Engine
void endList();
void drawList(GLuint list);
void callList(GLuint list);
+ void clearWorld();
void getScreenSize(int * width, int * height);
void drawText(const char * text, GLfloat r, GLfloat g, GLfloat b,
diff --git a/Video.cc b/Video.cc
index 41d286c..371f678 100644
--- a/Video.cc
+++ b/Video.cc
@@ -58,6 +58,7 @@ void Video::start(int width, int height, bool fullscreen, bool grab_input,
SDL_ShowCursor(SDL_DISABLE);
SDL_WM_GrabInput(SDL_GRAB_ON);
}
+ SDL_WM_SetCaption("Anaglym", "Anaglym");
m_inputGrabbed = grab_input;
m_fullscreen = fullscreen;
m_width = width;
diff --git a/ag.cc b/ag.cc
index a3c3959..9a9f103 100644
--- a/ag.cc
+++ b/ag.cc
@@ -57,6 +57,7 @@ namespace ag
// { "sleep", sleep },
{ "startFrame", startFrame },
{ "startList", startList },
+ { "clearWorld", clearWorld },
/* managed object functions */
{ "createBox", createBox },
@@ -765,6 +766,12 @@ namespace ag
return 1;
}
+ int clearWorld(lua_State * L)
+ {
+ g_engine->clearWorld();
+ return 0;
+ }
+
int endList(lua_State * L)
{
g_engine->endList();
diff --git a/ag.h b/ag.h
index 01cac42..6636e88 100644
--- a/ag.h
+++ b/ag.h
@@ -36,6 +36,7 @@ namespace ag
int sleep(lua_State * L);
int startFrame(lua_State * L);
int startList(lua_State * L);
+ int clearWorld(lua_State * L);
/* 2D overlay functions */
int drawArc(lua_State * L);
diff --git a/doc/index.html b/doc/index.html
index 9098f46..789268d 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -56,6 +56,13 @@ with the engine event specified.
See Lua event handlers for a list of events.
+
+clearWorld
+ag.clearWorld()
+
+This function removes all objects from the world.
+
+
doPhysics
ag.doPhysics()
diff --git a/lib/demo/checkers.lua b/lib/demo/checkers.lua
new file mode 100644
index 0000000..6bac0d0
--- /dev/null
+++ b/lib/demo/checkers.lua
@@ -0,0 +1,15 @@
+
+function createWorld()
+ board = ag.createBoxStatic(8, 8, 0.01)
+ board:setPosition(0, 0, -0.005)
+ board:setTexture(checker)
+ board:setTextureScale(2)
+ ground = ag.createPlane(0, 0, 1, -0.005)
+ ground:setColor(0, 0.4, 0)
+ ag.setCamera(2, -8, 8)
+end
+
+function init_event()
+ checker = ag.loadTexture("checker.jpg")
+ createWorld()
+end