Nilorea Library
C utilities for networking, threading, graphics
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 More...
 
#define CPU_USE_LESS   10
 wait more More...
 
#define CPU_USE_NICE   0
 let the other process have some times More...
 

Functions

void destroy_game_env (GAME_ENV **game)
 
int init_game_env (GAME_ENV **game)
 
GAME_ENVload_game_config (char *config_name)
 load a config from file More...
 

Detailed Description


Data Structure Documentation

◆ GAME_ENV

struct GAME_ENV

Game Environment structure.

Definition at line 33 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
int DONE loop while DONE != 1
int draw_time time before updating graphics in usec
int fade_value alpha value of black blit ( 20 default )
N_TIME game_timer TIMER.
int GFX_CONFIG_MODE GFX_OPENGL_WINDOWED.
int GFX_UPDATE_RATE time between two graphic frames 20000 default
int left_attack left attack trigger
int left_attack_pos left attack trigger
int level Level number.
int lifes Remainging lives.
int LOGIC_RATE time between two logic frames 20000 default
int logic_time time before a new logic update is done
int loop_time time between each loop
int nb_min_particles time before a new logic update is done
int real_framerate Measured framerate.
int right_attack left attack trigger
int right_attack_pos left attack trigger
int score Store score value.
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 26 of file n_games.h.

◆ CPU_USE_LESS

#define CPU_USE_LESS   10

wait more

Definition at line 30 of file n_games.h.

◆ CPU_USE_NICE

#define CPU_USE_NICE   0

let the other process have some times

Definition at line 28 of file n_games.h.

Function Documentation

◆ destroy_game_env()

void destroy_game_env ( GAME_ENV **  game)
Parameters
gamea pointer a to a game structure to destroy

Definition at line 58 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)
Parameters
gamea pointer to a game structure to allocate
Returns
TRUE or FALSE

Definition at line 15 of file n_games.c.

References CPU_USE_FULL, 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 config from file

Parameters
config_namethe name of the game file config
Returns
Loaded config or NULL

Definition at line 75 of file n_games.c.

References CPU_USE_FULL, CPU_USE_LESS, CPU_USE_NICE, destroy_game_env(), init_game_env(), LOG_ERR, LOG_NOTICE, and n_log.

+ Here is the call graph for this function: