summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-05-12 23:08:00 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-05-12 23:08:00 +0200
commitf20dfd8240c5cab969b25a3c1e986b28c97f6898 (patch)
tree421171edf089cd50b70f44366cb02ad7fa251be3 /main.c
parentf194481a520a39a1964348011df8deb108f789b7 (diff)
main menu work
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/main.c b/main.c
index ab4c64c..710abe6 100644
--- a/main.c
+++ b/main.c
@@ -31,6 +31,7 @@
#include "include/sprite.h"
#include "include/editor.h"
#include "include/glass_doors.h"
+#include "include/menu.h"
#include "src/map.c"
#include "src/players.c"
@@ -55,12 +56,19 @@
#include "src/sprite.c"
#include "src/editor.c"
#include "src/glass_doors.c"
+#include "src/menu.c"
#define CONFIG_DIRECTORY "zombieshooter"
void update_func(platform_window* window) {
renderer->render_clear(window, rgb(0,0,0));
- update_game(window);
+
+ if (global_scene_state == SCENE_GAME) {
+ update_game(window);
+ }
+ else if (global_scene_state == SCENE_MAIN_MENU) {
+ update_menu(window);
+ }
}
@@ -114,15 +122,19 @@ int main(int argc, char **argv)
else {
log_info("Audio failed.");
}
-
+
load_menu_assets();
+ play_music(music_menu);
init_game();
bool did_handle_args = false;
while(platform_keep_running(window)) {
if (global_asset_collection.done_loading_assets && !did_handle_args && global_state.state == GAMESTATE_LOADING_ASSETS) {
- handle_args(argc, argv);
+ if (argc > 1) {
+ handle_args(argc, argv);
+ global_scene_state = SCENE_GAME;
+ }
did_handle_args = true;
}