aboutsummaryrefslogtreecommitdiff
path: root/game.h
blob: ce8d3a3e07bcddac8a83015c46b8a133a526aeb1 (plain) (blame)
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_h
#define game_h

#include "world.h"
#include "menu.h"

typedef enum {
	game_state_menu = 0,
	game_state_game,
	game_state_credits,
	game_state_dead,
	game_state_win
} Game_State;

typedef struct Game Game;

typedef struct {
	void (*state_init)(Game* game);
	void (*state_update)(Game* game);
	void (*state_deinit)(Game* game);
} Game_State_Fns;

struct Game {
	const Game_State_Fns* fns;
	Game_State state;
	Menu menu;

	World world;
	int first;
	int wave_timer, want_next, display_wave_text, display_tutorial;
	int wait_timer, wait_timer2, fading, fade_timer, fade_frame;
};

void game_init(Game* game, Game_State state);
void game_update(Game* game);
void game_deinit(Game* game);

void game_change_state(Game* game, Game_State state);

void gameplay_next_wave(Game* menu);
void gameplay_new(Game* game);

#endif