diff options
Diffstat (limited to 'src/engine/Engine.hpp')
-rw-r--r-- | src/engine/Engine.hpp | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/src/engine/Engine.hpp b/src/engine/Engine.hpp index c9e9229e..513d82be 100644 --- a/src/engine/Engine.hpp +++ b/src/engine/Engine.hpp @@ -60,66 +60,46 @@ public: virtual ~Engine(); - virtual void set_driver(SharedPtr<Driver> driver); - virtual void add_event_source(SharedPtr<EventSource> source); - virtual bool activate(); - virtual void deactivate(); - /** - Indicate that a quit is desired + virtual void deactivate(); - This function simply sets a flag which affects the return value of - main_iteration, it does not actually force the engine to stop running or - block. The code driving the engine is responsible for stopping and - cleaning up when main_iteration returns false. - */ virtual void quit(); - /** - Run a single iteration of the main context. - - The main context post-processes events and performs housekeeping duties - like collecting garbage. This should be called regularly, e.g. a few - times per second. The return value indicates whether execution should - continue; i.e. if false is returned, a quit has been requested and the - caller should cease calling main_iteration() and stop the engine. - */ virtual bool main_iteration(); - /** - Process all events for this process cycle. + void set_driver(SharedPtr<Driver> driver); - Must be called (likely by the Driver) from the process thread. - */ - virtual void process_events(ProcessContext& context); + void add_event_source(SharedPtr<EventSource> source); - virtual ClientBroadcaster* broadcaster() const { return _broadcaster; } - virtual BufferFactory* buffer_factory() const { return _buffer_factory; } - virtual ControlBindings* control_bindings() const { return _control_bindings; } - virtual Driver* driver() const { return _driver.get(); } - virtual Raul::Maid* maid() const { return _maid; } - virtual MessageContext* message_context() const { return _message_context; } - virtual NodeFactory* node_factory() const { return _node_factory; } - virtual PostProcessor* post_processor() const { return _post_processor; } - virtual Shared::World* world() const { return _world; } + void process_events(ProcessContext& context); - virtual SharedPtr<EngineStore> engine_store() const; + ClientBroadcaster* broadcaster() const { return _broadcaster; } + BufferFactory* buffer_factory() const { return _buffer_factory; } + ControlBindings* control_bindings() const { return _control_bindings; } + Driver* driver() const { return _driver.get(); } + Raul::Maid* maid() const { return _maid; } + MessageContext* message_context() const { return _message_context; } + NodeFactory* node_factory() const { return _node_factory; } + PostProcessor* post_processor() const { return _post_processor; } + Shared::World* world() const { return _world; } + + SharedPtr<EngineStore> engine_store() const; private: + ClientBroadcaster* _broadcaster; + BufferFactory* _buffer_factory; + ControlBindings* _control_bindings; + SharedPtr<Driver> _driver; + Raul::Maid* _maid; + MessageContext* _message_context; + NodeFactory* _node_factory; + PostProcessor* _post_processor; + Shared::World* _world; + typedef std::set< SharedPtr<EventSource> > EventSources; EventSources _event_sources; - ClientBroadcaster* _broadcaster; - BufferFactory* _buffer_factory; - ControlBindings* _control_bindings; - SharedPtr<Driver> _driver; - Raul::Maid* _maid; - MessageContext* _message_context; - NodeFactory* _node_factory; - PostProcessor* _post_processor; - Shared::World* _world; - bool _quit_flag; }; |