]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Engine.hh
fixed layer bugs; generalized octree
[chaz/yoink] / src / Moof / Engine.hh
index 76120c49c890b45bba4beb618504f3ea76403df2..e49f44db853cbf30ca59539a5ab6f04bac64a1be 100644 (file)
 #ifndef _MOOF_ENGINE_HH_
 #define _MOOF_ENGINE_HH_
 
-#include <stdexcept>
-
 #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(int argc, char* argv[], const std::string& configFile,
-                       const std::string& name, const std::string& iconFile);
-       virtual ~Engine();
+       Engine(int argc, char* argv[], const std::string& name, 
+                       const std::string& iconFile, const std::string& configFile);
+       ~Engine() {}
+
+       // get global instance
+       static Engine& getInstance();
 
-       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 : 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<EngineImpl> impl_;
+       class Impl;
+       boost::shared_ptr<Impl> impl_;
 };
 
 
This page took 0.018557 seconds and 4 git commands to generate.