X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.hh;h=e49f44db853cbf30ca59539a5ab6f04bac64a1be;hp=112b87ea8dba3ea07f8d1cbefe5407003e045b4e;hb=a4debfe4a5f5d339410788971b698ba00cb7f09c;hpb=c2321281bf12a7efaedde930422c7ddbc92080d4 diff --git a/src/Moof/Engine.hh b/src/Moof/Engine.hh index 112b87e..e49f44d 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Engine.hh @@ -31,44 +31,56 @@ #include -#include -#include +#include +#include #include -#include namespace Mf { -// forward declaration +// forward declarations class Video; -class Engine : public Singleton +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 impl_; + class Impl; + boost::shared_ptr impl_; };