Nox Engine
 
Loading...
Searching...
No Matches
Game Class Reference

The central class responsible for the game loop, window creation, and event handling. More...

#include <Game.h>

Collaboration diagram for Game:
Collaboration graph

Public Member Functions

 Game ()
 Game constructor.
 
 ~Game ()
 Game deconstructor.
 
void init (const char *title, int xpos, int ypos, int width, int height, bool fullscreen)
 Initializes the SDL window, renderer, and subsystems.
 
void handleEvents ()
 Processes SDL events such as keyboard input and window closure.
 
void ghostSpawn ()
 Placeholder function for ghost spawning logic.
 
void update ()
 Updates the state of the game world.
 
void render ()
 Renders all game objects to the screen.
 
void clean ()
 Cleans up resources and shuts down SDL.
 
bool running ()
 Checks if the game loop is currently running.
 

Static Public Member Functions

static void setPause (bool pause)
 Sets the paused state of the game.
 
static const bool getPaused ()
 Gets the current paused state of the game.
 

Static Public Attributes

static float deltaTime
 The time in seconds it took to complete the last frame.
 
static float timeScale
 A factor to scale time, allowing for slow-motion or fast-forward effects.
 
static SDL_Event event
 The global SDL event object.
 
static SDL_Rendererrenderer
 The global SDL renderer.
 
static SDL_Point mouseCoords
 The current screen coordinates of the mouse.
 
static bool mouseButtonPressed
 True if the primary mouse button is currently pressed.
 

Detailed Description

The central class responsible for the game loop, window creation, and event handling.

Member Function Documentation

◆ getPaused()

static const bool Game::getPaused ( )
static

Gets the current paused state of the game.

Returns
True if the game is paused, false otherwise.
Here is the caller graph for this function:

◆ init()

void Game::init ( const char title,
int  xpos,
int  ypos,
int  width,
int  height,
bool  fullscreen 
)

Initializes the SDL window, renderer, and subsystems.

Parameters
titleThe title of the window.
xposThe initial x-position of the window.
yposThe initial y-position of the window.
widthThe width of the window.
heightThe height of the window.
fullscreenWhether to start the game in fullscreen mode.

◆ running()

bool Game::running ( )
inline

Checks if the game loop is currently running.

Returns
True if the game is running, false otherwise.

◆ setPause()

static void Game::setPause ( bool  pause)
static

Sets the paused state of the game.

Parameters
pauseTrue to pause the game, false to resume.

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