GameKit  0.0.1a
C++ gamedev tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gk::CoreApplication Class Reference

Base class for your own Application. More...

#include <CoreApplication.hpp>

Public Member Functions

 CoreApplication (int argc, char **argv)
 Constructor. More...
 
int run (bool isProtected=true)
 Run the application. More...
 

Protected Member Functions

virtual void init ()
 Initialization function. More...
 
void createWindow (u16 screenWidth, u16 screenHeight, const char *windowTitle)
 Open window. More...
 
virtual void onEvent (const SDL_Event &event)
 This function is called when a new window event is received. More...
 
virtual void handleEvents ()
 Poll window events and send them to onEvent() and ApplicationStateStack. More...
 
virtual void mainLoop ()
 Game main loop, automatically called by run() More...
 

Protected Attributes

SDLLoader m_sdlLoader
 Init and free SDL. More...
 
bool m_loadSDL = true
 If this flag is set to false, SDL won't be loaded. More...
 
ApplicationStateStack m_stateStack
 Stack containing application states. More...
 
GameClock m_clock
 Simulated time system. More...
 
ResourceHandler m_resourceHandler
 Container for all game resources. More...
 
Window m_window
 The main window. More...
 
RenderStates m_renderStates = RenderStates::Default
 The default render states. More...
 
ArgumentParser m_argumentParser
 Helper for argument management. More...
 

Detailed Description

Base class for your own Application.

This class provides an interface to create your own application.

You should add a class named Application that inherits from this class.

Definition at line 30 of file CoreApplication.hpp.

Constructor & Destructor Documentation

§ CoreApplication()

gk::CoreApplication::CoreApplication ( int  argc,
char **  argv 
)

Constructor.

Parameters
argcArgument count
argvArgument strings

Definition at line 23 of file CoreApplication.cpp.

Member Function Documentation

§ createWindow()

void gk::CoreApplication::createWindow ( u16  screenWidth,
u16  screenHeight,
const char *  windowTitle 
)
protected

Open window.

Parameters
screenWidthWindow width
screenHeightWindow height
windowTitleWindow caption

Opens a new window with defined size and title.

Definition at line 74 of file CoreApplication.cpp.

§ handleEvents()

void gk::CoreApplication::handleEvents ( )
protectedvirtual

Poll window events and send them to onEvent() and ApplicationStateStack.

This function is automatically called by mainLoop()

Definition at line 84 of file CoreApplication.cpp.

§ init()

void gk::CoreApplication::init ( )
protectedvirtual

Initialization function.

This function is used to init engine and singletons.

Definition at line 26 of file CoreApplication.cpp.

§ mainLoop()

void gk::CoreApplication::mainLoop ( )
protectedvirtual

Game main loop, automatically called by run()

Definition at line 94 of file CoreApplication.cpp.

§ onEvent()

void gk::CoreApplication::onEvent ( const SDL_Event &  event)
protectedvirtual

This function is called when a new window event is received.

Parameters
eventEvent received from SDL

This function is automatically called by handleEvents()

Definition at line 78 of file CoreApplication.cpp.

§ run()

int gk::CoreApplication::run ( bool  isProtected = true)

Run the application.

Parameters
isProtectedExceptions are catched if this parameter is set to true (default)

Loads SDL libraries, run init(), then mainLoop()

Definition at line 41 of file CoreApplication.cpp.

Member Data Documentation

§ m_argumentParser

ArgumentParser gk::CoreApplication::m_argumentParser
protected

Helper for argument management.

Definition at line 112 of file CoreApplication.hpp.

§ m_clock

GameClock gk::CoreApplication::m_clock
protected

Simulated time system.

Definition at line 104 of file CoreApplication.hpp.

§ m_loadSDL

bool gk::CoreApplication::m_loadSDL = true
protected

If this flag is set to false, SDL won't be loaded.

Definition at line 100 of file CoreApplication.hpp.

§ m_renderStates

RenderStates gk::CoreApplication::m_renderStates = RenderStates::Default
protected

The default render states.

Definition at line 110 of file CoreApplication.hpp.

§ m_resourceHandler

ResourceHandler gk::CoreApplication::m_resourceHandler
protected

Container for all game resources.

Definition at line 106 of file CoreApplication.hpp.

§ m_sdlLoader

SDLLoader gk::CoreApplication::m_sdlLoader
protected

Init and free SDL.

Definition at line 99 of file CoreApplication.hpp.

§ m_stateStack

ApplicationStateStack gk::CoreApplication::m_stateStack
protected

Stack containing application states.

Definition at line 102 of file CoreApplication.hpp.

§ m_window

Window gk::CoreApplication::m_window
protected

The main window.

Definition at line 108 of file CoreApplication.hpp.


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