TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_game_application.hpp
1 
9 #ifndef TurtleBrains_GameApplication_hpp
10 #define TurtleBrains_GameApplication_hpp
11 
12 #include <turtle_brains/application/tb_realtime_application.hpp>
13 #include <turtle_brains/graphics/tb_texture_manager.hpp> //For PixelSpace typedef.
14 
15 namespace TurtleBrains
16 {
17  namespace Game
18  {
19  class GameScene;
20 
26  class GameApplication : public Application::RealtimeApplication, public tbCore::Error::ErrorHandlerInterface
27  {
28  public:
44  explicit GameApplication(const tbApplication::WindowMode& windowMode = tbApplication::WindowMode::Windowed,
45  const tbGraphics::PixelSpace& windowWidth = 0, const tbGraphics::PixelSpace& windowHeight = 0,
46  const bool verticalSync = true, const bool allowWindowResize = false,
47  Application::ApplicationHandlerInterface* applicationHandler = nullptr);
48 
52  explicit GameApplication(const tbApplication::WindowProperties& windowProperties, const bool allowWindowResize = false,
53  Application::ApplicationHandlerInterface* applicationHandler = nullptr);
54 
58  ~GameApplication(void);
59 
67  void RunGame(GameScene& gameScene);
68 
72  static void MarkForClose(void);
73 
78  static bool IsGameActive(void);
79 
89  static int GetFrameRate(void);
90 
91  private:
92 
97  virtual void OnErrorFired(const std::string& errorMessage) override;
98 
99  GameScene* mErrorScene;
100  };
101 
102  }; /* namespace Game */
103 }; /* namespace TurtleBrains */
104 
105 namespace tbGame = TurtleBrains::Game;
106 
107 #endif /* TurtleBrains_GameApplication_hpp */
GameApplication(const tbApplication::WindowMode &windowMode=tbApplication::WindowMode::Windowed, const tbGraphics::PixelSpace &windowWidth=0, const tbGraphics::PixelSpace &windowHeight=0, const bool verticalSync=true, const bool allowWindowResize=false, Application::ApplicationHandlerInterface *applicationHandler=nullptr)
Definition: tb_game_application.hpp:26
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
Definition: tb_game_scene.hpp:28
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.hpp:36
Definition: tb_application_window.hpp:29
Handle events from the application/window and actions from the user of your application by deriving a...
Definition: tb_application_handler_interface.hpp:32
Definition: tb_realtime_application.hpp:43
This is the heart of TurtleBrains for game developers to create GameScenes and Entities to interact w...
void RunGame(GameScene &gameScene)