RogueLife/src/game.h

49 lines
1.3 KiB
C
Raw Normal View History

2021-06-04 15:14:12 +02:00
//---
// game: Static and dynamic information relating to an unfolding game
//---
#pragma once
#include "map.h"
#include "entities.h"
#include "render.h"
#include "level.h"
typedef struct game {
/* The map's coordinate system is the primary coordinate system in all of
this game's code */
map_t map;
/* User's camera */
camera_t camera;
/* List of entities */
entity_t **entities;
int entity_count;
/* Player; this must be one of the entities loaded in the game */
entity_t *player;
/* List of effect areas */
effect_area_t **effect_areas;
int effect_area_count;
2021-06-04 15:14:12 +02:00
} game_t;
/* Allocate resources to load a level. */
bool game_load(game_t *g, level_t *level);
/* Free resources allocated for the level. */
void game_unload(game_t *g);
2021-06-15 17:27:30 +02:00
/* Add an entity to the game (takes ownership; e will be freed). */
2021-06-04 15:14:12 +02:00
void game_add_entity(game_t *g, entity_t *e);
2021-06-15 17:27:30 +02:00
/* Add an effect area to the game (takes ownership; ea will be freed). */
void game_add_effect_area(game_t *g, effect_area_t *ea);
2021-06-15 17:27:30 +02:00
/* Update all entities' and effect areas' animations. */
2021-06-09 20:47:39 +02:00
void game_update_animations(game_t *g, fixed_t dt);
2021-06-15 17:27:30 +02:00
/* Update all effect areas and apply their effects. */
void game_update_effect_areas(game_t *g, fixed_t dt);
2021-06-15 17:27:30 +02:00
/* Sort entities by increasing y position (which is rendering order). */
void game_sort_entities(game_t *g);