aboutsummaryrefslogtreecommitdiff
path: root/game.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 09:02:04 +1000
committerquou <quou@disroot.org>2023-05-06 09:02:04 +1000
commit2ab411c4b8855d11d48454a93262e8eae3ba7fc7 (patch)
treee608ebd0bea71570be0a3619f9848f975669e5ef /game.h
parentfb104368dd33b66e0575dcc0327cbae7046a4e1e (diff)
Menus, game over, dying, etc.
Diffstat (limited to 'game.h')
-rw-r--r--game.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/game.h b/game.h
new file mode 100644
index 0000000..6562673
--- /dev/null
+++ b/game.h
@@ -0,0 +1,36 @@
+#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;
+
+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;
+};
+
+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);
+
+#endif