Add music, fix main menu scene

This commit is contained in:
2024-01-28 18:17:39 +01:00
parent 77d6173962
commit dfc20b6a96
7 changed files with 105 additions and 31 deletions

View File

@@ -106,7 +106,6 @@ bool init(void *userData) {
ECS_COMPONENT_DEFINE(ECS, Game);
ecs_singleton_set(ECS, Game, {});
Game *game = ecs_singleton_get_mut(ECS, Game);
setScreen(game, SCREEN_MAIN_MENU);
game->font = LoadFontEx("assets/fonts/CompassPro.ttf", 92, NULL, 0);
game->drawQuery = ecs_query(ECS, {
.filter.terms = {
@@ -142,6 +141,7 @@ bool init(void *userData) {
SoundState *sounds = ecs_singleton_get_mut(ECS, SoundState);
soundsLoad(sounds, SOUND_WOOD_PUNCH, 0.1f, "assets/sounds/wood hit 17.wav");
}
setScreen(game, SCREEN_MAIN_MENU);
game->stackAlloc = bzStackAllocCreate(10 * 1000 * 1000); // 10 MB
// init pools
@@ -310,6 +310,7 @@ void deinit(void *userData) {
bzObjectPoolDestroy(game->pools.btNodeState);
soundsUnloadAll(sounds);
soundsUnloadMusicStream(sounds);
bzUIDestroy(UI);
UI = NULL;
@@ -356,6 +357,9 @@ void update(float dt, void *userData) {
case SCREEN_SETTINGS:
break;
}
SoundState *soundState = ecs_singleton_get_mut(ECS, SoundState);
soundsUpdate(soundState);
}
static void drawOverScreen(Color c) {