Arcade Shooter
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
KatanaEngine::Game Class Referenceabstract

Base class for all games. Provides graphics initialization, game loop, and rendering code. Inherit from this class when creating your own game. More...

#include <Game.h>

Inheritance diagram for KatanaEngine::Game:
ShooterLibrary::Game Sample::Game

Public Member Functions

virtual int Run ()
 Runs the game instance. More...
 
virtual std::string GetName () const =0
 Gets the name of the game. More...
 
virtual ResourceManagerGetResourceManager () const
 Gets a pointer to the ResourceManager, for loading and managing resources. More...
 
virtual ScreenManagerGetScreenManager () const
 Gets a pointer to the ScreenManager, for managing game screens. More...
 
virtual ParticleManagerGetParticleManager () const
 Gets a pointer to the ParticleManager, for managing particle effects. More...
 
virtual SpriteBatchGetSpriteBatch () const
 Gets a pointer to the SpriteBatch, for rendering. More...
 
virtual void LoadContent (ResourceManager *pResourceManager)
 Called when resources need to be loaded. More...
 
virtual void UnloadContent ()
 Called when resources need to be unloaded. Override this method to unload any game-specific resources.
 
virtual void Update (const GameTime *pGameTime)
 Called when the game has determined that game logic needs to be processed. More...
 
virtual void Draw (SpriteBatch *pSpriteBatch)
 Called when the game determines it is time to draw a frame. More...
 
virtual void Quit ()
 Quits the game.
 

Static Public Member Functions

static int GetScreenWidth ()
 Gets the screen width in pixels. More...
 
static int GetScreenHeight ()
 Gets the screen width in pixels. More...
 
static Vector2 GetScreenCenter ()
 Gets the screen size in pixels. More...
 

Protected Member Functions

virtual void SetResourceDirectory (const std::string &path)
 Sets the location of the directory where the game's resources are stored. More...
 
virtual void SetTargetFramesPerSecond (int const frames)
 Sets the target frame rate for the game. More...
 
virtual void SetFrameCounterFont (Font *pFont)
 Sets the font for the frame counter. More...
 
virtual void InitializeScreenManager ()
 Initializes the game's ScreenManager.
 
virtual void InitializeParticleManager ()
 Initializes the game's ParticleManager.
 
virtual void DisplayFrameRate ()
 Displays the game's current frame rate.
 
virtual void SetFullScreen (bool isFullScreen)
 Sets the game to display in fullscreen mode.
 
virtual void SetOpenGLFlag ()
 Sets the OpenGL flag, which forces OpenGL rendering.
 
virtual void ResetGameTime ()
 Resets the game's timing values.
 

Static Protected Member Functions

static void SetScreenResolution (int width, int height)
 Sets the screen resolution. More...
 
static void SetWindowTitle (std::string title)
 Sets the title of the game window. More...
 

Detailed Description

Base class for all games. Provides graphics initialization, game loop, and rendering code. Inherit from this class when creating your own game.

Member Function Documentation

◆ Draw()

void KatanaEngine::Game::Draw ( SpriteBatch pSpriteBatch)
virtual

Called when the game determines it is time to draw a frame.

Parameters
pSpriteBatchThe game's sprite batch, used for rendering.

◆ GetName()

virtual std::string KatanaEngine::Game::GetName ( ) const
pure virtual

Gets the name of the game.

Returns
The name of the game.

Implemented in Sample::Game.

◆ GetParticleManager()

virtual ParticleManager* KatanaEngine::Game::GetParticleManager ( ) const
inlinevirtual

Gets a pointer to the ParticleManager, for managing particle effects.

Returns
A pointer to the game's ParticleManager instance.

◆ GetResourceManager()

virtual ResourceManager* KatanaEngine::Game::GetResourceManager ( ) const
inlinevirtual

Gets a pointer to the ResourceManager, for loading and managing resources.

Returns
A pointer to the game's ResourceManager instance.

◆ GetScreenCenter()

static Vector2 KatanaEngine::Game::GetScreenCenter ( )
inlinestatic

Gets the screen size in pixels.

Returns
A Point representing the width and height of the screen.

◆ GetScreenHeight()

static int KatanaEngine::Game::GetScreenHeight ( )
inlinestatic

Gets the screen width in pixels.

Returns
The width in pixels.

◆ GetScreenManager()

virtual ScreenManager* KatanaEngine::Game::GetScreenManager ( ) const
inlinevirtual

Gets a pointer to the ScreenManager, for managing game screens.

Returns
A pointer to the game's ScreenManager instance.

◆ GetScreenWidth()

static int KatanaEngine::Game::GetScreenWidth ( )
inlinestatic

Gets the screen width in pixels.

Returns
The width in pixels.

◆ GetSpriteBatch()

virtual SpriteBatch* KatanaEngine::Game::GetSpriteBatch ( ) const
inlinevirtual

Gets a pointer to the SpriteBatch, for rendering.

Returns
A pointer to the game's SpriteBatch instance.

◆ LoadContent()

virtual void KatanaEngine::Game::LoadContent ( ResourceManager pResourceManager)
inlinevirtual

Called when resources need to be loaded.

Parameters
pResourceManagerThe game's resource manager, used for loading and managing game resources.

◆ Run()

int KatanaEngine::Game::Run ( )
virtual

Runs the game instance.

Returns
Error code for exit status.

◆ SetFrameCounterFont()

virtual void KatanaEngine::Game::SetFrameCounterFont ( Font pFont)
inlineprotectedvirtual

Sets the font for the frame counter.

Parameters
pFontA pointer to the font.

◆ SetResourceDirectory()

virtual void KatanaEngine::Game::SetResourceDirectory ( const std::string &  path)
inlineprotectedvirtual

Sets the location of the directory where the game's resources are stored.

Parameters
pathThe relative path to the resource directory.

◆ SetScreenResolution()

static void KatanaEngine::Game::SetScreenResolution ( int  width,
int  height 
)
inlinestaticprotected

Sets the screen resolution.

Parameters
widthThe width of the screen in pixels.
heightThe height of the screen in pixels.

◆ SetTargetFramesPerSecond()

void KatanaEngine::Game::SetTargetFramesPerSecond ( int const  frames)
protectedvirtual

Sets the target frame rate for the game.

Parameters
framesThe target number of frames per second.

◆ SetWindowTitle()

static void KatanaEngine::Game::SetWindowTitle ( std::string  title)
inlinestaticprotected

Sets the title of the game window.

Parameters
titleThe window title.
Remarks
If the window title is not set, the game's name will be displayed in the title.

◆ Update()

void KatanaEngine::Game::Update ( const GameTime pGameTime)
virtual

Called when the game has determined that game logic needs to be processed.

Parameters
pGameTimeTiming values including time since last update.

The documentation for this class was generated from the following files: