6 n__games_8h
gullradriel edited this page 2026-10-09 00:55:18 +02:00

include/nilorea/n_games.h

Games helpers functions. More...

Structures

Name
struct GAME_ENV
Game Environment structure.

Detailed Description

Games helpers functions.

Author: Castagnier Mickael

Version: 2.0

Date: 26/06/2015

Source code

/*
 * Nilorea Library
 * Copyright (C) 2005-2026 Castagnier Mickael
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 */


#ifndef __N_GAMES__
#define __N_GAMES__

#ifdef __cplusplus
extern "C" {
#endif

#include "n_common.h"
#include "n_log.h"
#include "n_time.h"

#ifdef HAVE_ALLEGRO
#include <allegro5/allegro.h>
#endif

#define CPU_USE_FULL -1
#define CPU_USE_NICE 0
#define CPU_USE_LESS 10

#define GFX_WINDOWED 0
#define GFX_FULLSCREEN 1
#define GFX_FULLSCREEN_WINDOW 2

typedef struct GAME_ENV {
    int score,
        lifes,
        BLUR,
        fade_value,
        DONE,
        GFX_CONFIG_MODE,
        CPU_MODE,
        loop_time,
        draw_time,
        logic_time,
        nb_min_particles,
        wait_for_slowing_down_cpu,
        GFX_UPDATE_RATE,
        LOGIC_RATE,
        real_framerate,
        level,
        x,
        y,
        z,
        left_attack,
        right_attack,
        left_attack_pos,
        right_attack_pos;

    N_TIME game_timer;

#ifdef HAVE_ALLEGRO
    ALLEGRO_DISPLAY* display;
    ALLEGRO_BITMAP* scrbuf;
    ALLEGRO_EVENT_QUEUE* event_queue;
    ALLEGRO_TIMER* logic_timer;
    ALLEGRO_TIMER* draw_timer;
#endif

} GAME_ENV;

int init_game_env(GAME_ENV** game);

void destroy_game_env(GAME_ENV** game);

GAME_ENV* load_game_config(char* config_name);


#ifdef __cplusplus
}
#endif

#endif /* #ifndef __N_GAMES__  */