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