#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
* layer from the bottom up every timestep. It also draws each layer from the
- * bottom up, adhering to the maximum frame-rate. Events are send to each layer
+ * 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
* as long as there are layers on the stack.
{
public:
+ Engine();
~Engine() {}
+
+ // loads settings: rngseed, timestep, framerate, showfps
+ bool initWithSettings(const Settings& settings);
- // get global instance
- static Engine& getInstance();
+ 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 setTimestep(int ts);
- int getTimestep() const;
-
- void setMaxFps(int maxFps); // draw rate is always capped at the timestep
- int getMaxFps() const;
-
int getFps() const;
void push(LayerP layer); // push a layer onto the top
private:
- Engine(); // use getInstance() to access the engine
-
class Impl;
boost::shared_ptr<Impl> mImpl;
};
+extern Engine engine;
+
+
} // namespace Mf
#endif // _MOOF_ENGINE_HH_