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 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 * implied. See the License for the specific language governing
15 * permissions and limitations under the License.
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 */
19
28#ifndef __N_GAMES__
29#define __N_GAMES__
30
31#ifdef __cplusplus
32extern "C" {
33#endif
39#include "n_common.h"
40#include "n_log.h"
41#include "n_time.h"
42
43#ifdef HAVE_ALLEGRO
44#include <allegro5/allegro.h>
45#endif
46
48#define CPU_USE_FULL -1
50#define CPU_USE_NICE 0
52#define CPU_USE_LESS 10
53
55#define GFX_WINDOWED 0
57#define GFX_FULLSCREEN 1
59#define GFX_FULLSCREEN_WINDOW 2
60
127
129int init_game_env(GAME_ENV** game);
130
132void destroy_game_env(GAME_ENV** game);
133
135GAME_ENV* load_game_config(char* config_name);
136
141#ifdef __cplusplus
142}
143#endif
144
145#endif /* #ifndef __N_GAMES__ */
int lifes
Remaining lives.
Definition n_games.h:66
int nb_min_particles
minimum number of particles
Definition n_games.h:84
int x
position x
Definition n_games.h:96
N_TIME game_timer
TIMER.
Definition n_games.h:111
ALLEGRO_DISPLAY * display
Allegro5 display.
Definition n_games.h:115
int GFX_UPDATE_RATE
time between two graphic frames 20000 default
Definition n_games.h:88
ALLEGRO_TIMER * logic_timer
logic timer
Definition n_games.h:121
int BLUR
wanna blur effect ? ( 0 or 1 )
Definition n_games.h:68
ALLEGRO_TIMER * draw_timer
drawing timer
Definition n_games.h:123
ALLEGRO_EVENT_QUEUE * event_queue
event queue
Definition n_games.h:119
int CPU_MODE
status of the cpu mode , CPU_USE_FULL by default
Definition n_games.h:76
int left_attack_pos
left attack position
Definition n_games.h:106
ALLEGRO_BITMAP * scrbuf
screen buffer bitmap
Definition n_games.h:117
int DONE
loop while DONE != 1
Definition n_games.h:72
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:86
int loop_time
time between each loop
Definition n_games.h:78
int right_attack
right attack trigger
Definition n_games.h:104
int LOGIC_RATE
time between two logic frames 20000 default
Definition n_games.h:90
int level
Level number.
Definition n_games.h:94
int left_attack
left attack trigger
Definition n_games.h:102
int logic_time
time before a new logic update is done
Definition n_games.h:82
int score
Store score value.
Definition n_games.h:64
int z
position z
Definition n_games.h:100
int draw_time
time before updating graphics in usec
Definition n_games.h:80
int GFX_CONFIG_MODE
display mode: GFX_WINDOWED, GFX_FULLSCREEN, or GFX_FULLSCREEN_WINDOW
Definition n_games.h:74
int fade_value
alpha value of black blit ( 20 default )
Definition n_games.h:70
int real_framerate
Measured framerate.
Definition n_games.h:92
int right_attack_pos
right attack position
Definition n_games.h:108
int y
position y
Definition n_games.h:98
void destroy_game_env(GAME_ENV **game)
destroy a game environment
Definition n_games.c:82
GAME_ENV * load_game_config(char *config_name)
load a game config from file
Definition n_games.c:106
int init_game_env(GAME_ENV **game)
initialize a new game environment
Definition n_games.c:35
Game Environment structure.
Definition n_games.h:62
Timing Structure.
Definition n_time.h:49
Common headers and low-level functions & define.
Generic log system.
Timing utilities.