GameKit  0.0.1a
C++ gamedev tools
CoreApplication.hpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: CoreApplication.hpp
5  *
6  * Description:
7  *
8  * Created: 14/06/2018 01:59:51
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
14 #ifndef GK_COREAPPLICATION_HPP_
15 #define GK_COREAPPLICATION_HPP_
16 
19 #include "gk/core/GameClock.hpp"
20 #include "gk/core/SDLLoader.hpp"
21 #include "gk/core/Window.hpp"
23 
24 namespace gk {
25 
31  public:
39  CoreApplication(int argc, char **argv);
40 
49  int run(bool isProtected = true);
50 
51  protected:
58  virtual void init();
59 
70  void createWindow(u16 screenWidth, u16 screenHeight, const char *windowTitle);
71 
80  virtual void onEvent(const SDL_Event &event);
81 
88  virtual void handleEvents();
89 
94  virtual void mainLoop();
95 
97  // Member data
100  bool m_loadSDL = true;
101 
103 
105 
107 
109 
111 
113 };
114 
115 } // namespace gk
116 
117 #endif // GK_COREAPPLICATION_HPP_
118 
virtual void onEvent(const SDL_Event &event)
This function is called when a new window event is received.
ResourceHandler m_resourceHandler
Container for all game resources.
Window m_window
The main window.
CoreApplication(int argc, char **argv)
Constructor.
GameClock m_clock
Simulated time system.
void createWindow(u16 screenWidth, u16 screenHeight, const char *windowTitle)
Open window.
unsigned short u16
Definition: IntTypes.hpp:22
RenderStates m_renderStates
The default render states.
virtual void init()
Initialization function.
int run(bool isProtected=true)
Run the application.
bool m_loadSDL
If this flag is set to false, SDL won&#39;t be loaded.
static const RenderStates Default
ApplicationStateStack m_stateStack
Stack containing application states.
Base class for your own Application.
virtual void handleEvents()
Poll window events and send them to onEvent() and ApplicationStateStack.
Stack containing ApplicationState instances.
virtual void mainLoop()
Game main loop, automatically called by run()
SDLLoader m_sdlLoader
Init and free SDL.
ArgumentParser m_argumentParser
Helper for argument management.