added lib/demo/checkers.lua; setting window caption to "Anaglym"; added ag::clearWorld() and documentation
git-svn-id: svn://anubis/anaglym/trunk@221 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
de49999c88
commit
a5680ca2b8
@ -529,6 +529,15 @@ void Engine::callList(GLuint list)
|
||||
glCallList(list);
|
||||
}
|
||||
|
||||
void Engine::clearWorld()
|
||||
{
|
||||
while (!m_objects.empty())
|
||||
{
|
||||
std::map<int, Object *>::iterator it = m_objects.begin();
|
||||
removeObject(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void Engine::debug_hook(lua_Debug * debug)
|
||||
{
|
||||
Uint32 ticks = SDL_GetTicks();
|
||||
|
1
Engine.h
1
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,
|
||||
|
1
Video.cc
1
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;
|
||||
|
7
ag.cc
7
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();
|
||||
|
1
ag.h
1
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);
|
||||
|
@ -56,6 +56,13 @@ with the engine event specified.
|
||||
See <a href="#handlers">Lua event handlers</a> for a list of events.
|
||||
</p>
|
||||
|
||||
<a name="ag_clearWorld" />
|
||||
<h3>clearWorld</h3>
|
||||
<p><tt>ag.clearWorld()</tt></p>
|
||||
<p>
|
||||
This function removes all objects from the world.
|
||||
</p>
|
||||
|
||||
<a name="ag_doPhysics" />
|
||||
<h3>doPhysics</h3>
|
||||
<p><tt>ag.doPhysics()</tt></p>
|
||||
|
15
lib/demo/checkers.lua
Normal file
15
lib/demo/checkers.lua
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user