diff --git a/Engine.cc b/Engine.cc index cb196f5..6ec8e89 100644 --- a/Engine.cc +++ b/Engine.cc @@ -125,6 +125,7 @@ Engine::Engine(const string & path, Video & video) m_exitEvent.user.code = 1; m_event_init_present = false; + m_event_reinit_present = false; m_event_update_present = false; m_event_update_overlay_present = false; m_event_key_down_present = false; @@ -216,6 +217,7 @@ bool Engine::load(const char * program) void Engine::checkForAllHandlerFunctions() { checkForFunction("init_event", init); + checkForFunction("reinit_event", reinit); checkForFunction("update_event", update); checkForFunction("update_overlay_event", update_overlay); checkForFunction("key_down_event", key_down); @@ -952,6 +954,15 @@ void Engine::reloadProgram() { importFullPath(m_program_path.c_str()); 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() diff --git a/Engine.h b/Engine.h index 0b949cc..02f98ef 100644 --- a/Engine.h +++ b/Engine.h @@ -219,6 +219,7 @@ class Engine FTFont * m_font; bool m_event_init_present; + bool m_event_reinit_present; bool m_event_update_present; bool m_event_update_overlay_present; bool m_event_key_down_present; diff --git a/doc/index.html b/doc/index.html index c79abbd..f21d904 100644 --- a/doc/index.html +++ b/doc/index.html @@ -38,6 +38,14 @@ The library functions are documented below.
ag.callList(display_list)
+
+This function invokes a display list created with +startList(). +
+ag.clearEventHandler(event_name)
@@ -125,6 +133,20 @@ See setAutoDrawObjects for more information.
+ +ag.drawPoint(size, r, g, b, x, y [, z])
++This function draws a point to the screen. +The size of the point is given by size. +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, z defaults to 0. +This function can be called from either the update_event +or the update_overlay_event. +
+ag.drawRect(r, g, b, width, height, x, y [, rot])
@@ -170,6 +192,16 @@ See setAutoEndFrame for more information. + +ag.endList()
++This function ends the creation of a display list created with +startList(). +Every call to startList() should have a corresponding call +to endList(). +
+ag.exit()
@@ -411,6 +443,18 @@ mode is enabled. See ag.setAutoStartFrame(). + +displaylist = ag.startList()
++This function instructs the engine to start a display list. +Any draw*() functions called between startList() +and endList() will be stored in the display +list for efficient execution. +The display list can be called with +callList(). +
+