SDLApplication Class Reference

Represents a realtime app using SDL. More...

#include <Application/SDLApplication.h>

Inherited by BrickOutGame.

List of all members.

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
SDLScreenscreen
SDLMousemouse
SDLKeyboardkeyboard
Console console
FramesPerSecond fps
ImageMgr imageMgr
FontMgr fontMgr
SoundSampleMgr soundSampleMgr
SoundStreamMgr soundStreamMgr
FontRef systemFontSmall
FontRef systemFont
FontRef systemFontLarge
FontRef consoleFont
ConVarg_showFps
IEnvironmentlocalEnv

Detailed Description

Represents a realtime app using SDL.


Constructor & Destructor Documentation

SDLApplication::SDLApplication ( int  w,
int  h,
bool  useFullscreen 
)

Constructor.

Parameters:
[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.

Member Function Documentation

virtual bool SDLApplication::ApplicationInit (  )  [inline, protected, virtual]

Initializes the application. All subsystems (including the global environment) is valid when this is called.

Returns:
True if the initialization was successful, false otherwise.
virtual void SDLApplication::Draw ( float  dt  )  [protected, pure virtual]

Draw method called once each frame.

Parameters:
[in] dt the time in seconds since the last frame.
virtual std::string SDLApplication::GetAppName (  )  [inline, virtual]

Gets the applications name.

Returns:
The name of the application.

Reimplemented in BrickOutGame.

virtual const char* SDLApplication::GetIconName (  )  [inline, virtual]

Returns the image name of the application icon.

Returns:
The file name of the icon or NULL if there is no icon.

NOTE: Only used on Windows.

Reimplemented in BrickOutGame.

bool SDLApplication::HaveFocus (  )  const [virtual]

Determines if the application has input focus.

Returns:
True if the application has input focus.
bool SDLApplication::Init ( int  argc,
char *  argv[] 
)

Initializes the application.

Parameters:
[in] argc the number of argument strings in argv.
[in] argv an array of null-terminated c strings holding the arguments.
Returns:
True if the initialization was successful, false otherwise.

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.

Returns:
True if the initialization was successful, false otherwise.
virtual bool SDLApplication::IsPaused (  )  const [inline, virtual]

Returns if the application is paused or not.

Returns:
True if the application is paused or false if the application is unpaused.

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().

Returns:
True if the application should exit at the end of the frame. Returns false if the application should ignore the quit message.
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.

Parameters:
[in] dt the time in seconds since the last frame.
Returns:
True if the application should continue. Returns false if the application should exit.

Member Data Documentation

The command line information for the application.

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.

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.

pointer to the keyboard.

the Environment associated with this application.

pointer to the mouse.

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.


The documentation for this class was generated from the following files:
Generated on Mon Apr 5 19:08:06 2010 for BrickOut |ReDuX| by  doxygen 1.6.3