X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEngine.hh;h=f088dc56e85fcb663766594a2c9b454788e7c519;hp=76120c49c890b45bba4beb618504f3ea76403df2;hb=5fa5f117f28922a7e539a432367960c1a61f837d;hpb=72d4af22710317acffab861421c4364b1780b6fe diff --git a/src/Moof/Engine.hh b/src/Moof/Engine.hh index 76120c4..f088dc5 100644 --- a/src/Moof/Engine.hh +++ b/src/Moof/Engine.hh @@ -35,8 +35,8 @@ #include #include +#include #include -#include namespace Mf { @@ -45,11 +45,15 @@ namespace Mf { // forward declaration class Video; -class Engine : public Singleton +class Engine { -public: +protected: + Engine(int argc, char* argv[], const std::string& configFile, const std::string& name, const std::string& iconFile); + +public: + virtual ~Engine(); int run(); @@ -63,20 +67,27 @@ public: Video& getVideo(); long getFrameRate(); - // Override these if you want. + // override these if you want virtual void update(Scalar t, Scalar dt); virtual void draw(Scalar alpha); virtual void handleEvent(const Event& event); - struct Exception : std::runtime_error + struct Exception : public Mf::Exception { - explicit Exception(const std::string& what_arg) : - std::runtime_error(what_arg) {} + explicit Exception(unsigned error) : + Mf::Exception(error) {} + + void raise() + { + throw *this; + } }; private: - class EngineImpl; - boost::shared_ptr impl_; + Engine() {} // this class must be subclassed to be useful + + class Impl; + boost::shared_ptr impl_; };