TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
TurtleBrains::Game::GameApplication Class Reference

#include <tb_game_application.h>

Inheritance diagram for TurtleBrains::Game::GameApplication:
TurtleBrains::Application::RealtimeApplication TurtleBrains::Core::Noncopyable

Public Member Functions

 GameApplication (void)
 ~GameApplication (void)
void RunGame (GameScene &gameScene)
void SetApplicationHandler (Application::ApplicationHandlerInterface *applicationHandler)
- Public Member Functions inherited from TurtleBrains::Application::RealtimeApplication
 RealtimeApplication (ApplicationHandlerInterface &applicationHandler)
 ~RealtimeApplication (void)
void Open (void)
void Run (void)
void Close (void)
void SetWindowMenu (const ApplicationMenu &menu)
void SetContextMenu (const ApplicationMenu &menu)
void SetWindowStatus (const ApplicationStatus &status)
void SetWindowTitle (const tbCore::tbString &windowTitle)
void OpenDialog (const ApplicationDialog &dialog)
void CloseDialog (const ApplicationDialog &dialog)
bool OkayMessageBox (const tbCore::tbString &title, const tbCore::tbString &message)
bool OkayCancelMessageBox (const tbCore::tbString &title, const tbCore::tbString &message)
bool OpenFileDialog (tbCore::tbString &fileToOpen, const tbCore::tbString &fileExtension)
bool SaveFileDialog (tbCore::tbString &fileToSave, const tbCore::tbString &fileExtension)

Detailed Description

the GameApplication will create a basic ApplicationHandler and RealtimeApplication, and get the game state machine running. Simply create an instance of each of your gamestates and call RunGame and let the GameApplication handle the rest.

Constructor & Destructor Documentation

TurtleBrains::Game::GameApplication::GameApplication ( void  )

Constructs the GameApplication object, opens the RealTime window with the size of 1280x720. An error condition will be triggered if there is already a GameApplication instance in existance or if there were any trouble opening the real time application window. Also adds itself as an error handler that will popup a message box with the error contents.

TurtleBrains::Game::GameApplication::~GameApplication ( void  )

Destroys the GameApplication object and removes itself from the list of error handlers.

Member Function Documentation

void TurtleBrains::Game::GameApplication::RunGame ( GameScene gameScene)

Begins running the real-time message pump for the window, starts first with the TurtleBrains introduction scene (in release builds) and then sets the provided gameScene as the active scene.

gameSceneThe first scene of the game to be active, usually a splash or title screen before the gameplay begins.
void TurtleBrains::Game::GameApplication::SetApplicationHandler ( Application::ApplicationHandlerInterface applicationHandler)

Set a custom application handler to complement the default handler of the game application. When creating a game with a built in editor it is useful to handle the Menu and Dialog actions of the application.

applicationHandlerA custom application handler to be called during certain handled events.
not all handler functions will be called on the provided application handler, currently only the OnMenuAction and OnDialogAction calls are made.