UGDK  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
engine.h
Go to the documentation of this file.
1 #ifndef UGDK_SYSTEM_ENGINE_H_
2 #define UGDK_SYSTEM_ENGINE_H_
3 
4 #include <ugdk/action.h>
5 #include <ugdk/debug.h>
6 #include <ugdk/system.h>
8 
9 #include <functional>
10 #include <list>
11 #include <memory>
12 
13 #ifdef SWIG
14 #define GET_OWNERSHIP(T) T&&
15 #else
16 #define GET_OWNERSHIP(T) T
17 #endif
18 
19 namespace ugdk {
20 namespace system {
21 
22 typedef std::function<std::unique_ptr<action::Scene> ()> SceneFactory;
23 
28 
32 bool Initialize(const Configuration& configuration);
33 
35 bool Initialize();
36 
38 void Run();
39 
41 void Suspend();
42 
44 void Release();
45 
53 
55 void PushSceneFactory(const std::function<std::unique_ptr<action::Scene>()>& scene_factory);
56 
58 
59 void PushScene(GET_OWNERSHIP(std::unique_ptr<action::Scene>) scene);
60 
63 
65 
66 const std::list<std::unique_ptr<action::Scene>>& scene_list();
67 
71 const std::list<std::shared_ptr<const debug::SectionData>>& profile_data_list();
72 
75 
78 
81 
86 void RegisterSDLHandler(const SDLEventHandler*);
87 void DeregisterSDLHandler(const SDLEventHandler*);
88 
92 } // namespace system
93 } // namespace ugdk
94 
95 #endif
96 
A game scene, or screen.
Definition: scene.h:29
void PushSceneFactory(const std::function< std::unique_ptr< action::Scene >()> &scene_factory)
Queues a scene to be added just before the start of the next frame.
EventHandler & GetCurrentSceneEventHandler()
Returns the EventHandler for the current scene.
void DeregisterSDLHandler(const SDLEventHandler *)
Definition: animation.h:11
#define GET_OWNERSHIP(T)
Definition: engine.h:16
void PushScene(GET_OWNERSHIP(std::unique_ptr< action::Scene >) scene)
Queues a scene to be added just before the start of the next frame.
const Configuration & CurrentConfiguration()
Returns the current configuration.
Definition: eventhandler.h:40
std::function< std::unique_ptr< action::Scene >)> SceneFactory
Definition: engine.h:22
void RegisterSDLHandler(const SDLEventHandler *)
void Suspend()
Stops the main loop.
EventHandler & GlobalEventHandler()
Returns the global EventHandler.
void Run()
Starts running the engine.
void Release()
Releases all the resouces allocated by the engine.
const std::list< std::shared_ptr< const debug::SectionData > > & profile_data_list()
Definition: configuration.h:13
action::Scene & CurrentScene()
Returns the currently focused scene.
const std::list< std::unique_ptr< action::Scene > > & scene_list()
Returns the scene list.
bool Initialize(const Configuration &configuration)
Initializes the engine. Returns true if sucessful, false otherwise.