The Table Engine
gameapp.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include "SDL2/SDL.h"
5 
23  SDL_Window* m_window = NULL;
24  SDL_Renderer* m_renderer = NULL;
25 
26  bool m_gameIsRunning = true;
27 
28  float m_FPS = 0;
29 
34  GameApplication(std::string title);
35 
40 
44  void printStats();
45 
49  void start(bool demo);
50 
55  void input();
56 
61  void update();
62 
67  void render();
68 
72  void advanceFrame();
73 
78  void runLoop();
79 };
Manages the main game loop, rendering, and application state.
Definition: gameapp.h:22
void runLoop()
The main game loop that runs continuously while the game is active. This loop calls the input,...
Definition: gameapp.cpp:158
SDL_Window * m_window
Pointer to the SDL_Window.
Definition: gameapp.h:23
SDL_Renderer * m_renderer
Pointer to the SDL_Renderer used for all rendering in the game.
Definition: gameapp.h:24
void advanceFrame()
Advances the game frame, updating timing and FPS calculations.
Definition: gameapp.cpp:152
float m_FPS
Frames per second, updated during the game loop to measure performance.
Definition: gameapp.h:28
void render()
Renders the game state to the window. This function should be called once per frame to draw all game ...
Definition: gameapp.cpp:142
void printStats()
Prints current game statistics like FPS.
Definition: gameapp.cpp:68
bool m_gameIsRunning
Flag to control the game loop.
Definition: gameapp.h:26
void start(bool demo)
Starts the game application, initializing all necessary resources.
Definition: gameapp.cpp:47
~GameApplication()
Destructor that cleans up SDL resources.
Definition: gameapp.cpp:40
void input()
Processes input from the user. This function should be called in the game loop to handle events like ...
Definition: gameapp.cpp:125
GameApplication(std::string title)
Constructs a GameApplication with a specified window title.
Definition: gameapp.cpp:21
void update()
Updates the game state. This function should be called once per frame to update the state of the game...
Definition: gameapp.cpp:138