Represents a realtime app using SDL. More...
#include <Application/SDLApplication.h>
Inherited by BrickOutGame.
Public Member Functions | |
SDLApplication (int w, int h, bool useFullscreen) | |
Constructor. | |
virtual | ~SDLApplication () |
De-constructor. | |
virtual uint | GetMajorVersion () const |
Returns the major version number of the game. | |
virtual uint | GetMinorVersion () const |
Returns the minor version number of the game. | |
virtual uint | GetBuildNumber () const |
Returns the build number number of the game. | |
virtual const char * | GetVersionType () const |
Returns an optional versioning identifier (alpha, beta, RC, etc.). | |
virtual const char * | GetVersionString () const |
Returns the complete version string of the game. | |
bool | Init (int argc, char *argv[]) |
Initializes the application. | |
int | Run () |
Enters the applications main event loop. | |
virtual const char * | GetIconName () |
Returns the image name of the application icon. | |
virtual void | TogglePause () |
Pauses the application if it is unpaused or unpauses the application if it is paused. | |
virtual void | Pause () |
Pauses the application. | |
virtual void | UnPause () |
Unpauses the application. | |
virtual bool | IsPaused () const |
Returns if the application is paused or not. | |
virtual bool | HaveFocus () const |
Determines if the application has input focus. | |
virtual uint | GetTickCount () const |
Returns the current tick count. | |
void | Exit () |
Informs the application to exit at the end of the current frame. | |
virtual std::string | GetAppName () |
Gets the applications name. | |
Protected Member Functions | |
virtual bool | InitSubSystems () |
Initializes any subsystems needed by the application. | |
virtual bool | ApplicationInit () |
Initializes the application. All subsystems (including the global environment) is valid when this is called. | |
virtual void | PreFrame () |
Called before the start of the frame. | |
virtual void | PostFrame () |
Called after the frame is complete. | |
virtual bool | Update (float dt)=0 |
Update method called once each frame. | |
virtual void | Draw (float dt)=0 |
Draw method called once each frame. | |
virtual void | OnLostFocus () |
Called when the application looses focus. | |
virtual void | OnGainedFocus () |
Called when the application gains focus. | |
virtual void | OnLostMouseFocus () |
Called when the application mouse focus. | |
virtual void | OnGainedMouseFocus () |
Called when the application gains mouse focus. | |
virtual bool | OnApplicationExitRequest () |
Called when the application receives a message to quit from the OS or a call to Exit(). | |
Protected Attributes | |
CommandLine | commandLine |
int | width |
int | height |
bool | fullscreen |
SDLScreen * | screen |
SDLMouse * | mouse |
SDLKeyboard * | keyboard |
Console | console |
FramesPerSecond | fps |
ImageMgr | imageMgr |
FontMgr | fontMgr |
SoundSampleMgr | soundSampleMgr |
SoundStreamMgr | soundStreamMgr |
FontRef | systemFontSmall |
FontRef | systemFont |
FontRef | systemFontLarge |
FontRef | consoleFont |
ConVar * | g_showFps |
IEnvironment * | localEnv |
Represents a realtime app using SDL.
SDLApplication::SDLApplication | ( | int | w, | |
int | h, | |||
bool | useFullscreen | |||
) |
Constructor.
[in] | w | the initial width of the application screen. |
[in] | h | the initial height of the application screen. |
[in] | useFullscreen | set to true to start the application fullscreen. |
virtual bool SDLApplication::ApplicationInit | ( | ) | [inline, protected, virtual] |
Initializes the application. All subsystems (including the global environment) is valid when this is called.
virtual void SDLApplication::Draw | ( | float | dt | ) | [protected, pure virtual] |
Draw method called once each frame.
[in] | dt | the time in seconds since the last frame. |
virtual std::string SDLApplication::GetAppName | ( | ) | [inline, virtual] |
virtual const char* SDLApplication::GetIconName | ( | ) | [inline, virtual] |
Returns the image name of the application icon.
NOTE: Only used on Windows.
Reimplemented in BrickOutGame.
bool SDLApplication::HaveFocus | ( | ) | const [virtual] |
Determines if the application has input focus.
bool SDLApplication::Init | ( | int | argc, | |
char * | argv[] | |||
) |
Initializes the application.
[in] | argc | the number of argument strings in argv. |
[in] | argv | an array of null-terminated c strings holding the arguments. |
NOTE: This function must be called (and return true) before calling Run.
virtual bool SDLApplication::InitSubSystems | ( | ) | [inline, protected, virtual] |
Initializes any subsystems needed by the application.
virtual bool SDLApplication::IsPaused | ( | ) | const [inline, virtual] |
Returns if the application is paused or not.
Reimplemented in BrickOutGame.
virtual bool SDLApplication::OnApplicationExitRequest | ( | ) | [inline, protected, virtual] |
Called when the application receives a message to quit from the OS or a call to Exit().
virtual void SDLApplication::PostFrame | ( | ) | [inline, protected, virtual] |
Called after the frame is complete.
NOTE: The environment is valid for the current frame but not the next.
virtual void SDLApplication::PreFrame | ( | ) | [inline, protected, virtual] |
Called before the start of the frame.
NOTE: The environment is valid for the current frame.
int SDLApplication::Run | ( | ) |
Enters the applications main event loop.
NOTE: Assumes that Init() has been called and returned true.
virtual bool SDLApplication::Update | ( | float | dt | ) | [protected, pure virtual] |
Update method called once each frame.
[in] | dt | the time in seconds since the last frame. |
CommandLine SDLApplication::commandLine [protected] |
The command line information for the application.
Console SDLApplication::console [protected] |
application console.
FontRef SDLApplication::consoleFont [protected] |
the font used by the console.
FontMgr SDLApplication::fontMgr [protected] |
the font manager.
FramesPerSecond SDLApplication::fps [protected] |
calculates the frames per second.
bool SDLApplication::fullscreen [protected] |
the init value indicating fullscreen use.
ConVar* SDLApplication::g_showFps [protected] |
console variable to control the fps display.
int SDLApplication::height [protected] |
the init height of the application screen.
ImageMgr SDLApplication::imageMgr [protected] |
the image manager.
SDLKeyboard* SDLApplication::keyboard [protected] |
pointer to the keyboard.
IEnvironment* SDLApplication::localEnv [protected] |
the Environment associated with this application.
SDLMouse* SDLApplication::mouse [protected] |
pointer to the mouse.
SDLScreen* SDLApplication::screen [protected] |
the screen the application draws to.
SoundSampleMgr SDLApplication::soundSampleMgr [protected] |
the sound sampler manager.
SoundStreamMgr SDLApplication::soundStreamMgr [protected] |
the sound stream manager.
FontRef SDLApplication::systemFont [protected] |
the normal font used by the application.
FontRef SDLApplication::systemFontLarge [protected] |
the large font used by the application.
FontRef SDLApplication::systemFontSmall [protected] |
the small font used by the application.
int SDLApplication::width [protected] |
the init width of the application screen.