diff engine/core/controller/engine.h @ 694:ca1fcb96907d

Added pre- and post-rendering hooks for executing custom rendering code. * The functions FIFE::Engine.register(Pre|Post)RenderingHook are used to register custom rendering hooks to execute before and after thepredefined rendering functions in the main loop. * The rendering hook registration functions are also exposed to the Python bindings and accept any native C or Python functions.
author M. George Hansen <technopolitica@gmail.com>
date Fri, 10 Jun 2011 23:35:30 -1000
parents 5d6b1820b953
children ecaa4d98f05f
line wrap: on
line diff
--- a/engine/core/controller/engine.h	Tue Apr 19 16:13:37 2011 +0000
+++ b/engine/core/controller/engine.h	Fri Jun 10 23:35:30 2011 -1000
@@ -42,6 +42,8 @@
 #include "enginesettings.h"
 #include "video/devicecaps.h"
 
+typedef void (*Callback)();
+
 namespace gcn {
 	class Graphics;
 }
@@ -132,6 +134,16 @@
 		 */
 		void pump();
 
+		/** Register a callback function to call before rendering the main
+		 * scene.
+		 */
+		void registerPreRenderCallback(Callback callback);
+
+		/** Register a callback function to call after rendering the main
+		 * scene.
+		 */
+		void registerPostRenderCallback(Callback callback);
+
 		/** Provides access point to the SoundManager
 		 */
 		SoundManager* getSoundManager() const { return m_soundmanager; }
@@ -213,6 +225,9 @@
 		Cursor* m_cursor;
 		bool m_destroyed;
 
+		Callback m_prerender_callback;
+		Callback m_postrender_callback;
+
 		EngineSettings m_settings;
 		DeviceCaps m_devcaps;