-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_state.h
75 lines (53 loc) · 1.29 KB
/
game_state.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef GAME_STATE_H
#define GAME_STATE_H
#include "game_mode.h"
#include "include/raylib.h"
#include "include/wasm3.h"
#include "net.h"
#include "player.h"
#include "map.h"
#include "input.h"
#include "projectile.h"
typedef enum GamePage {
MainMenu,
InGame,
Settings,
} GamePage;
typedef struct InGameState {
Player* players;
Ability default_ability;
Weapon default_weapon;
uint8_t num_players;
Projectile* projectiles;
uint16_t num_projectiles;
const Team* winning_team;
GameModeData game_mode_data;
Camera2D camera;
Map map;
NetworkInfo network_info;
KeyBindings key_bindings;
uint16_t countdown_frames_to_main_menu;
uint64_t current_game_mode_index;
uint64_t num_game_modes;
UninitGameMode* uninit_game_modes;
} InGameState;
typedef struct MainMenuState {
KeyBindings* key_bindings;
char* username;
Ability ability;
Weapon weapon;
bool hosting;
char* ip_addr;
char* game_mode_file_name;
uint64_t current_game_mode_index;
uint64_t num_game_modes;
UninitGameMode* uninit_game_modes;
uint8_t num_bots;
} MainMenuState;
typedef union GameState {
InGameState in_game_state;
MainMenuState main_menu_state;
} GameState;
void enter_state(GamePage* game_page, GameState* game_state, GamePage new_game_page);
void run_state(GamePage* game_page, GameState* game_state);
#endif