X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FCore.hh;fp=src%2FMoof%2FEngine.hh;h=fcb0340f3e5fbb93aec01ed6addbcc2a740c7848;hb=987971a961454d97082c6448fdc0bbeb540281bb;hp=28d7fa03eab8119d16a58ca5f2c81ad40da69ad5;hpb=be9ebc1104574e5e81e19c5caba0c23b54df826d;p=chaz%2Fyoink diff --git a/src/Moof/Engine.hh b/src/Moof/Core.hh similarity index 78% rename from src/Moof/Engine.hh rename to src/Moof/Core.hh index 28d7fa0..fcb0340 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Core.hh @@ -26,56 +26,43 @@ *******************************************************************************/ -#ifndef _MOOF_ENGINE_HH_ -#define _MOOF_ENGINE_HH_ +#ifndef _MOOF_CORE_HH_ +#define _MOOF_CORE_HH_ #include #include #include -#include #include 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 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: *************************************************/