updated documentation for display list functions

git-svn-id: svn://anubis/anaglym/trunk@218 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-12-16 02:28:40 +00:00
parent e88240f26f
commit d3a161b0a7
3 changed files with 56 additions and 0 deletions

View File

@ -125,6 +125,7 @@ Engine::Engine(const string & path, Video & video)
m_exitEvent.user.code = 1; m_exitEvent.user.code = 1;
m_event_init_present = false; m_event_init_present = false;
m_event_reinit_present = false;
m_event_update_present = false; m_event_update_present = false;
m_event_update_overlay_present = false; m_event_update_overlay_present = false;
m_event_key_down_present = false; m_event_key_down_present = false;
@ -216,6 +217,7 @@ bool Engine::load(const char * program)
void Engine::checkForAllHandlerFunctions() void Engine::checkForAllHandlerFunctions()
{ {
checkForFunction("init_event", init); checkForFunction("init_event", init);
checkForFunction("reinit_event", reinit);
checkForFunction("update_event", update); checkForFunction("update_event", update);
checkForFunction("update_overlay_event", update_overlay); checkForFunction("update_overlay_event", update_overlay);
checkForFunction("key_down_event", key_down); checkForFunction("key_down_event", key_down);
@ -952,6 +954,15 @@ void Engine::reloadProgram()
{ {
importFullPath(m_program_path.c_str()); importFullPath(m_program_path.c_str());
checkForAllHandlerFunctions(); checkForAllHandlerFunctions();
if (m_event_reinit_present)
{
lua_getfield(m_luaState, LUA_GLOBALSINDEX,
EVENT_HANDLER_AG_NAME(reinit));
/* call the init function - pops the function ref from the stack */
int s = lua_pcall(m_luaState, 0, 0, 0);
reportErrors(s);
}
} }
void Engine::doPhysics() void Engine::doPhysics()

View File

@ -219,6 +219,7 @@ class Engine
FTFont * m_font; FTFont * m_font;
bool m_event_init_present; bool m_event_init_present;
bool m_event_reinit_present;
bool m_event_update_present; bool m_event_update_present;
bool m_event_update_overlay_present; bool m_event_update_overlay_present;
bool m_event_key_down_present; bool m_event_key_down_present;

View File

@ -38,6 +38,14 @@ The library functions are documented below.
<a name="ag" /> <a name="ag" />
<h2><tt>ag</tt> library</h2> <h2><tt>ag</tt> library</h2>
<a name="ag_callList" />
<h3>callList</h3>
<p><tt>ag.callList(display_list)</tt><p>
<p>
This function invokes a display list created with
<a href="#ag_startList"><tt>startList()</tt></a>.
</p>
<a name="ag_clearEventHandler" /> <a name="ag_clearEventHandler" />
<h3>clearEventHandler</h3> <h3>clearEventHandler</h3>
<p><tt>ag.clearEventHandler(event_name)</tt><p> <p><tt>ag.clearEventHandler(event_name)</tt><p>
@ -125,6 +133,20 @@ See <a href="#ag_setAutoDrawObjects">setAutoDrawObjects</a>
for more information. for more information.
</p> </p>
<a name="ag_drawPoint" />
<h3>drawPoint</h3>
<p><tt>ag.drawPoint(size, r, g, b, x, y [, z])</tt></p>
<p>
This function draws a point to the screen.
The size of the point is given by <tt>size</tt>.
The point will be antialiased.
The color of the point is given by (r, g, b).
The position of the point is given by (x, y, z).
If not specified, <tt>z</tt> defaults to 0.
This function can be called from either the <tt>update_event</tt>
or the <tt>update_overlay_event</tt>.
</p>
<a name="ag_drawRect" /> <a name="ag_drawRect" />
<h3>drawRect</h3> <h3>drawRect</h3>
<p><tt>ag.drawRect(r, g, b, width, height, x, y [, rot])</tt></p> <p><tt>ag.drawRect(r, g, b, width, height, x, y [, rot])</tt></p>
@ -170,6 +192,16 @@ See <a href="#ag_setAutoEndFrame">setAutoEndFrame</a> for more
information. information.
</p> </p>
<a name="ag_endList" />
<h3>endList</h3>
<p><tt>ag.endList()</tt></p>
<p>
This function ends the creation of a display list created with
<a href="#ag_startList"><tt>startList()</tt></a>.
Every call to <tt>startList()</tt> should have a corresponding call
to <tt>endList()</tt>.
</p>
<a name="ag_exit" /> <a name="ag_exit" />
<h3>exit</h3> <h3>exit</h3>
<p><tt>ag.exit()</tt></p> <p><tt>ag.exit()</tt></p>
@ -411,6 +443,18 @@ mode is enabled.
See <a href="#ag_setAutoStartFrame">ag.setAutoStartFrame()</a>. See <a href="#ag_setAutoStartFrame">ag.setAutoStartFrame()</a>.
</p> </p>
<a name="ag_startList" />
<h3>startList</h3>
<p><tt>displaylist = ag.startList()</tt></p>
<p>
This function instructs the engine to start a display list.
Any <tt>draw*()</tt> functions called between <tt>startList()</tt>
and <a href="#ag_endList"><tt>endList()</tt></a> will be stored in the display
list for efficient execution.
The display list can be called with
<a href="#ag_callList"><tt>callList()</tt></a>.
</p>
<hr /> <hr />
<a name="object_creation" /> <a name="object_creation" />