X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.hh;h=84b1f588f57e41c55d5a185bec8e0d40abcca198;hp=0617b1a5c3094025331233fe4c8ced0a5742010e;hb=c9e20ac06383b20ceb5404c9237e319c2e90d157;hpb=57b78ebe21b1b48acd337daa5a1cb8c383959cfa diff --git a/src/Moof/Engine.hh b/src/Moof/Engine.hh index 0617b1a..84b1f58 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Engine.hh @@ -29,64 +29,49 @@ #ifndef _MOOF_ENGINE_HH_ #define _MOOF_ENGINE_HH_ -#include - #include -#include -#include +#include #include namespace Mf { -// forward declaration +// forward declarations class Video; class Engine { -protected: - - Engine(int argc, char* argv[], const std::string& configFile, - const std::string& name, const std::string& iconFile); - public: - virtual ~Engine(); + Engine(int argc, char* argv[], const std::string& name, + const std::string& iconFile, const std::string& configFile); + ~Engine() {} - int run(); - void stop(int exitCode = 0); + // get global instance + static Engine& getInstance(); + + void run(); void setTimestep(Scalar ts); - Scalar getTimestep(); + Scalar getTimestep() const; void setMaxFrameRate(long maxFps); - long getMaxFrameRate(); - - Video& getVideo(); - long getFrameRate(); - - // override these if you want - virtual void update(Scalar t, Scalar dt); - virtual void draw(Scalar alpha); - virtual void handleEvent(const Event& event); + long getMaxFrameRate() const; - struct Exception : public Mf::Exception - { - explicit Exception(unsigned error) : - Mf::Exception(error) {} + Video& getVideo() const; + long getFrameRate() const; - void raise() - { - throw *this; - } - }; + void push(LayerP layer); + LayerP pop(); + // pops a specific layer and all layers above it + LayerP pop(Layer* layer); + void clear(); private: - Engine() {} // this class must be subclassed to be useful class Impl; - boost::shared_ptr impl_; + boost::shared_ptr mImpl; };