Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
game_state.h File Reference
#include <stdbool.h>
#include "trc_world_position.h"

Go to the source code of this file.

Data Structures

struct  level_t
 
struct  game_state_t
 

Enumerations

enum  scenes_t { MAIN_MENU_SCENE , GAME_SCENE }
 

Functions

void init_game_state (void)
 
bool is_game_running (void)
 
bool is_debug_console_on (void)
 
bool is_top_down_view_on (void)
 
game_state_tget_game_state (void)
 
scenes_t get_current_scene (void)
 
int get_current_level_index (void)
 
level_t get_current_level_info (void)
 
trc_world_position_t get_current_map_dimensions (void)
 
float get_current_map_size (void)
 
int get_current_map_offset (void)
 
trc_world_position_t get_current_camera_spawn (void)
 
int get_fps (void)
 
void update_game_state_fps (const int fps)
 
void stop_game (void)
 
void update_debug_console_state (void)
 
void load_level (const int level_idx)
 
void reload_level (void)
 

Enumeration Type Documentation

◆ scenes_t

enum scenes_t

A scene represents a state for the game (like the main menu, options menu, specific level, boos fight, etc)

Enumerator
MAIN_MENU_SCENE 

The main menu, the first scene

GAME_SCENE 

Gameplay scene

Function Documentation

◆ get_current_camera_spawn()

trc_world_position_t get_current_camera_spawn ( void  )

Returns the camera spawn of the current level

◆ get_current_level_index()

int get_current_level_index ( void  )

Returns the current level id

◆ get_current_level_info()

level_t get_current_level_info ( void  )

Returns the info of the current level

◆ get_current_map_dimensions()

trc_world_position_t get_current_map_dimensions ( void  )

Returns the map dimensions of the current level in a trc_world_position_t

◆ get_current_map_offset()

int get_current_map_offset ( void  )

Returns the current map offset for the levels map array

◆ get_current_map_size()

float get_current_map_size ( void  )

Returns the map size of the current level

◆ get_current_scene()

scenes_t get_current_scene ( void  )

Returns the current scene being played

◆ get_fps()

int get_fps ( void  )

Returns the current FPS count

◆ get_game_state()

game_state_t * get_game_state ( void  )

Returns the current game state

◆ init_game_state()

void init_game_state ( void  )

Initialize the state of the game

The current state of ALL the program

◆ is_debug_console_on()

bool is_debug_console_on ( void  )

Returns if the debug console is begin shown

◆ is_game_running()

bool is_game_running ( void  )

Returns if the game is currently running

◆ is_top_down_view_on()

bool is_top_down_view_on ( void  )

Returns if the 2D top down view of the map is being shown

◆ load_level()

void load_level ( const int  level_idx)

Update the current map and camera info to be the level_idx level

Parameters
level_idxThe index of the level to get the info from (from 0 to LEVEL_COUNT)
Note
Calling this function will RESET the level (every door will be to the original state, the camera will be at the spawn of that level, etc)

◆ reload_level()

void reload_level ( void  )

Resets the current level

◆ stop_game()

void stop_game ( void  )

Sets the game_running variable to false

◆ update_debug_console_state()

void update_debug_console_state ( void  )

If the debug console is being shown, this turns it off

If the debug console is hidden, this turns it on

◆ update_game_state_fps()

void update_game_state_fps ( const int  fps)

Updates the count frame per second