#include <boost/shared_ptr.hpp>
-#include <Moof/Dispatcher.hh>
-#include <Moof/Event.hh>
+#include <Moof/Exception.hh>
+#include <Moof/Layer.hh>
#include <Moof/Math.hh>
-#include <Moof/Singleton.hh>
namespace Mf {
-// forward declaration
+// forward declarations
class Video;
-class Engine : public Singleton<Engine>
+struct Engine
{
-public:
- Engine(const std::string& name, int argc, char* argv[],
- const std::string& configFile);
- virtual ~Engine();
+ Engine(int argc, char* argv[], const std::string& name,
+ const std::string& iconFile, const std::string& configFile);
+ ~Engine() {}
- int run();
- void stop();
+ // get global instance
+ static Engine& getInstance();
+
+ void run();
void setTimestep(Scalar ts);
- Scalar getTimestep();
+ Scalar getTimestep() const;
void setMaxFrameRate(long maxFps);
- long getMaxFrameRate();
+ long getMaxFrameRate() const;
+
+ Video& getVideo() const;
+ long getFrameRate() const;
+
+ void push(LayerP layer);
+ LayerP pop();
+ // pops a specific layer and all layers above it
+ LayerP pop(Layer* layer);
+ void clear();
- Video& getVideo();
- long getFrameRate();
+ struct Exception : public Mf::Exception
+ {
+ explicit Exception(unsigned error) :
+ Mf::Exception(error) {}
- // Override these if you want.
- virtual void update(Scalar t, Scalar dt);
- virtual void draw(Scalar alpha);
- virtual void handleEvent(const Event& event);
+ void raise()
+ {
+ throw *this;
+ }
+ };
private:
- class EngineImpl;
- boost::shared_ptr<EngineImpl> impl_;
+ class Impl;
+ boost::shared_ptr<Impl> impl_;
};