]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Core.hh
refactoring needed for win32 crash
[chaz/yoink] / src / Moof / Core.hh
similarity index 78%
rename from src/Moof/Engine.hh
rename to src/Moof/Core.hh
index 28d7fa03eab8119d16a58ca5f2c81ad40da69ad5..fcb0340f3e5fbb93aec01ed6addbcc2a740c7848 100644 (file)
 
 *******************************************************************************/
 
-#ifndef _MOOF_ENGINE_HH_
-#define _MOOF_ENGINE_HH_
+#ifndef _MOOF_CORE_HH_
+#define _MOOF_CORE_HH_
 
 #include <boost/shared_ptr.hpp>
 
 #include <Moof/Dispatch.hh>
 #include <Moof/Error.hh>
-#include <Moof/Video.hh>
 #include <Moof/Layer.hh>
 
 
 namespace Mf {
 
 
-class Settings;
-
-
 /**
- * The engine is essentially a stack of layers.  While running, it updates each
+ * The core is essentially a stack of layers.  While running, it updates each
  * layer from the bottom up every timestep.  It also draws each layer from the
  * bottom up, adhering to the maximum frame-rate.  Events are sent to each layer
- * from the top down until a layer signals the event was handled.  The engine is
- * also responsible for firing timers on time.  The engine will continue running
+ * from the top down until a layer signals the event was handled.  The core is
+ * also responsible for firing timers on time.  The core will continue running
  * as long as there are layers on the stack.
  */
 
-class Engine
+class Core
 {
 public:
 
-       Engine();
-       ~Engine() {}
+       Core();
        
        // loads settings: rngseed, timestep, framerate, showfps
-       bool initWithSettings(const Settings& settings);
-
-       const Error& getError() const;
-       void clearError();
-
-       // setting the video is required before you can run the engine and should
-       // probably be done before adding any layers
-       void setVideo(VideoP video);
-       VideoP getVideo() const;
+       void init();
 
        int getFps() const;
 
        void push(LayerP layer);        // push a layer onto the top
        LayerP pop();                           // pop the top layer
        LayerP pop(Layer* layer);       // pops a specific layer and all layers above it
-       void clear();                           // remove all layers (the engine will stop)
+       void clear();                           // remove all layers (the core will stop)
 
        int getSize() const;            // get the size of the stack
 
@@ -96,13 +83,30 @@ private:
        boost::shared_ptr<Impl> mImpl;
 };
 
+extern Core core;
+
+
+/*
+ * Some classes and subsystems require certain backend libraries to be
+ * initialized.  This is the mechanism to accomplish that.  Classes which rely
+ * on any backend libraries just need to instantiate this class as a member.
+ * Backend cleanup will occur automagically when there are no more instances.
+ */
+
+class Backend
+{
+public:
+
+       Backend();
+       ~Backend();
 
-extern Engine engine;
+       static bool check(Error& error);
+};
 
 
 } // namespace Mf
 
-#endif // _MOOF_ENGINE_HH_
+#endif // _MOOF_CORE_HH_
 
 /** vim: set ts=4 sw=4 tw=80: *************************************************/
 
This page took 0.02194 seconds and 4 git commands to generate.