summaryrefslogtreecommitdiff
path: root/game-state.h
blob: 78e423f1864547c4de11153a0d746beae3c1ed08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef GAME_STATE_H
#define GAME_STATE_H

#include <raylib.h>

#include "player.h"
#include "def.h"
#include "enemy.h"
#include "tower.h"

extern const enemy_spawner_t DEFAULT_ENEMY_SPAWNER;
#define ENEMY_COUNT_MAX 1000
#define TOWER_COUNT_MAX 100
#define MAX_BEAM_COUNT 100
/* extern const int ENEMY_COUNT_MAX; */
/* extern const int TOWER_COUNT_MAX; */

typedef struct GameState {
    player_t player;
    tower_t towers[TOWER_COUNT_MAX];
    int tower_count;
    enemy_t enemies[ENEMY_COUNT_MAX];
    int enemy_count;
    tower_beam_t beams[MAX_BEAM_COUNT];
    int beam_count;
    enemy_spawner_t spawner;
    Texture2D *textures;
    RenderTexture2D bg_tiles;
} gs_t;

float mouse_x(gs_t *gs);
float mouse_y(gs_t *gs);

void add_tower(gs_t *gs, tower_t tower);
void add_enemy(gs_t *gs, enemy_t enemy);
void add_beam(gs_t *gs, tower_beam_t beam);
void kill_enemy(gs_t *gs, int index);
void update_game(gs_t *gs, float dt);
void draw_game(gs_t *gs);

void paint_tile();

#endif