Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
n_games.h
Go to the documentation of this file.
1/*
2 * Nilorea Library
3 * Copyright (C) 2005-2026 Castagnier Mickael
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
27#ifndef __N_GAMES__
28#define __N_GAMES__
29
30#ifdef __cplusplus
31extern "C" {
32#endif
38#include "n_common.h"
39#include "n_log.h"
40#include "n_time.h"
41
42#ifdef HAVE_ALLEGRO
43#include <allegro5/allegro.h>
44#endif
45
47#define CPU_USE_FULL -1
49#define CPU_USE_NICE 0
51#define CPU_USE_LESS 10
52
54#define GFX_WINDOWED 0
56#define GFX_FULLSCREEN 1
58#define GFX_FULLSCREEN_WINDOW 2
59
126
128int init_game_env(GAME_ENV** game);
129
131void destroy_game_env(GAME_ENV** game);
132
134GAME_ENV* load_game_config(char* config_name);
135
140#ifdef __cplusplus
141}
142#endif
143
144#endif /* #ifndef __N_GAMES__ */
int lifes
Remaining lives.
Definition n_games.h:65
int nb_min_particles
minimum number of particles
Definition n_games.h:83
int x
position x
Definition n_games.h:95
N_TIME game_timer
TIMER.
Definition n_games.h:110
ALLEGRO_DISPLAY * display
Allegro5 display.
Definition n_games.h:114
int GFX_UPDATE_RATE
time between two graphic frames 20000 default
Definition n_games.h:87
ALLEGRO_TIMER * logic_timer
logic timer
Definition n_games.h:120
int BLUR
wanna blur effect ? ( 0 or 1 )
Definition n_games.h:67
ALLEGRO_TIMER * draw_timer
drawing timer
Definition n_games.h:122
ALLEGRO_EVENT_QUEUE * event_queue
event queue
Definition n_games.h:118
int CPU_MODE
status of the cpu mode , CPU_USE_FULL by default
Definition n_games.h:75
int left_attack_pos
left attack position
Definition n_games.h:105
ALLEGRO_BITMAP * scrbuf
screen buffer bitmap
Definition n_games.h:116
int DONE
loop while DONE != 1
Definition n_games.h:71
int wait_for_slowing_down_cpu
=0 for doing nothing, =1 if logic is done, = 2 if drawing is done too
Definition n_games.h:85
int loop_time
time between each loop
Definition n_games.h:77
int right_attack
right attack trigger
Definition n_games.h:103
int LOGIC_RATE
time between two logic frames 20000 default
Definition n_games.h:89
int level
Level number.
Definition n_games.h:93
int left_attack
left attack trigger
Definition n_games.h:101
int logic_time
time before a new logic update is done
Definition n_games.h:81
int score
Store score value.
Definition n_games.h:63
int z
position z
Definition n_games.h:99
int draw_time
time before updating graphics in usec
Definition n_games.h:79
int GFX_CONFIG_MODE
display mode: GFX_WINDOWED, GFX_FULLSCREEN, or GFX_FULLSCREEN_WINDOW
Definition n_games.h:73
int fade_value
alpha value of black blit ( 20 default )
Definition n_games.h:69
int real_framerate
Measured framerate.
Definition n_games.h:91
int right_attack_pos
right attack position
Definition n_games.h:107
int y
position y
Definition n_games.h:97
void destroy_game_env(GAME_ENV **game)
destroy a game environment
Definition n_games.c:81
GAME_ENV * load_game_config(char *config_name)
load a game config from file
Definition n_games.c:105
int init_game_env(GAME_ENV **game)
initialize a new game environment
Definition n_games.c:34
Game Environment structure.
Definition n_games.h:61
Timing Structure.
Definition n_time.h:48
Common headers and low-level functions & define.
Generic log system.
Timing utilities.