Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
GAME APPS: game environment management utilities

Data Structures

struct  GAME_ENV
 Game Environment structure. More...
 

Macros

#define CPU_USE_FULL   -1
 full use of CPU
 
#define CPU_USE_LESS   10
 wait more
 
#define CPU_USE_NICE   0
 let the other process have some times
 
#define GFX_FULLSCREEN   1
 display mode: fullscreen
 
#define GFX_FULLSCREEN_WINDOW   2
 display mode: fullscreen windowed
 
#define GFX_WINDOWED   0
 display mode: windowed
 

Functions

void destroy_game_env (GAME_ENV **game)
 destroy a game environment
 
int init_game_env (GAME_ENV **game)
 initialize a new game environment
 
GAME_ENVload_game_config (char *config_name)
 load a game config from file
 

Detailed Description


Data Structure Documentation

◆ GAME_ENV

struct GAME_ENV

Game Environment structure.

Definition at line 61 of file n_games.h.

+ Collaboration diagram for GAME_ENV:
Data Fields
int BLUR wanna blur effect ? ( 0 or 1 )
int CPU_MODE status of the cpu mode , CPU_USE_FULL by default
ALLEGRO_DISPLAY * display Allegro5 display.
int DONE loop while DONE != 1
int draw_time time before updating graphics in usec
ALLEGRO_TIMER * draw_timer drawing timer
ALLEGRO_EVENT_QUEUE * event_queue event queue
int fade_value alpha value of black blit ( 20 default )
N_TIME game_timer TIMER.
int GFX_CONFIG_MODE display mode: GFX_WINDOWED, GFX_FULLSCREEN, or GFX_FULLSCREEN_WINDOW
int GFX_UPDATE_RATE time between two graphic frames 20000 default
int left_attack left attack trigger
int left_attack_pos left attack position
int level Level number.
int lifes Remaining lives.
int LOGIC_RATE time between two logic frames 20000 default
int logic_time time before a new logic update is done
ALLEGRO_TIMER * logic_timer logic timer
int loop_time time between each loop
int nb_min_particles minimum number of particles
int real_framerate Measured framerate.
int right_attack right attack trigger
int right_attack_pos right attack position
int score Store score value.
ALLEGRO_BITMAP * scrbuf screen buffer bitmap
int wait_for_slowing_down_cpu =0 for doing nothing, =1 if logic is done, = 2 if drawing is done too
int x position x
int y position y
int z position z

Macro Definition Documentation

◆ CPU_USE_FULL

#define CPU_USE_FULL   -1

full use of CPU

Definition at line 47 of file n_games.h.

◆ CPU_USE_LESS

#define CPU_USE_LESS   10

wait more

Definition at line 51 of file n_games.h.

◆ CPU_USE_NICE

#define CPU_USE_NICE   0

let the other process have some times

Definition at line 49 of file n_games.h.

◆ GFX_FULLSCREEN

#define GFX_FULLSCREEN   1

display mode: fullscreen

Definition at line 56 of file n_games.h.

◆ GFX_FULLSCREEN_WINDOW

#define GFX_FULLSCREEN_WINDOW   2

display mode: fullscreen windowed

Definition at line 58 of file n_games.h.

◆ GFX_WINDOWED

#define GFX_WINDOWED   0

display mode: windowed

Definition at line 54 of file n_games.h.

Function Documentation

◆ destroy_game_env()

void destroy_game_env ( GAME_ENV **  game)

destroy a game environment

Parameters
gamea pointer to a game structure to destroy

Definition at line 81 of file n_games.c.

References Free.

Referenced by load_game_config().

+ Here is the caller graph for this function:

◆ init_game_env()

int init_game_env ( GAME_ENV **  game)

initialize a new game environment

Parameters
gamea pointer to a game structure to allocate
Returns
TRUE or FALSE

Definition at line 34 of file n_games.c.

References CPU_USE_FULL, GFX_WINDOWED, LOG_ERR, Malloc, and n_log.

Referenced by load_game_config().

+ Here is the caller graph for this function:

◆ load_game_config()

GAME_ENV * load_game_config ( char *  config_name)

load a game config from file

Parameters
config_namepath to the game configuration file
Returns
allocated GAME_ENV with loaded settings, or NULL on error

Definition at line 105 of file n_games.c.

References CPU_MODE, CPU_USE_FULL, CPU_USE_LESS, CPU_USE_NICE, destroy_game_env(), GFX_CONFIG_MODE, GFX_FULLSCREEN, GFX_FULLSCREEN_WINDOW, GFX_UPDATE_RATE, GFX_WINDOWED, init_game_env(), LOG_ERR, LOG_NOTICE, LOGIC_RATE, n_log, and nb_min_particles.

+ Here is the call graph for this function: