diff options
| author | Ritabrata Das <[email protected]> | 2026-09-13 11:46:52 +0530 |
|---|---|---|
| committer | Ritabrata Das <[email protected]> | 2026-09-13 11:46:52 +0530 |
| commit | 074ca8c4b60bf5ab61be64a971105335c49ce8e8 (patch) | |
| tree | dfbbe640bdc9e790206770324145b570e24ce164 | |
| parent | 6488c942e10c7685a1040f6c6ff74a534e72b95c (diff) | |
add music
| -rw-r--r-- | assets/audio/bgm/bgm.mp3 | bin | 0 -> 1729293 bytes | |||
| -rw-r--r-- | lib/gameState.hpp | 4 | ||||
| -rw-r--r-- | main.cpp | 8 | ||||
| -rw-r--r-- | screen/main_menu.cpp | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/assets/audio/bgm/bgm.mp3 b/assets/audio/bgm/bgm.mp3 Binary files differnew file mode 100644 index 0000000..b4762d4 --- /dev/null +++ b/assets/audio/bgm/bgm.mp3 diff --git a/lib/gameState.hpp b/lib/gameState.hpp index edfedde..659f7e0 100644 --- a/lib/gameState.hpp +++ b/lib/gameState.hpp @@ -12,8 +12,6 @@ constexpr int VIRTUAL_SCREEN_H = 400; constexpr float WEB_RENDER_SCALE = 2.0f; constexpr Vector2 ZERO_VEC = {0,0}; -inline Music g_bgMusic; - enum DialogueState { DIALOGUE_OFF, DIALOGUE_SCROLLING, @@ -113,4 +111,6 @@ struct GameState { bool GameOver = false; float GameOverTime = -1.0f; std::set<int> explored = {}; + + Music BGMusic; }; @@ -19,7 +19,8 @@ namespace { void drawFrame(GameState& currentGameState) { - UpdateMusicStream(g_bgMusic); + UpdateMusicStream(currentGameState.BGMusic); + printf("%f\n", GetMusicTimePlayed(currentGameState.BGMusic)); // if (GetMusicTimePlayed(g_bgMusic) >= GetMusicTimeLength(g_bgMusic)) { // SeekMusicStream(g_bgMusic, 0); // } @@ -123,9 +124,8 @@ int main() { // }; // TODO : Implement Asset Manager // DisableCursor(); - // g_bgMusic = LoadMusicStream("../assets/audio/bgm/bg.wav"); - // PlayMusicStream(g_bgMusic); - SetMusicVolume(g_bgMusic, 0.5f); + currentGameState.BGMusic = LoadMusicStream("../assets/audio/bgm/bgm.mp3"); + PlayMusicStream(currentGameState.BGMusic); currentGameState.AssetManager.init(); #if defined (__EMSCRIPTEN__) currentGameState.touchScreenMode = (bool)isOnPhone(); diff --git a/screen/main_menu.cpp b/screen/main_menu.cpp index bc7ad08..afe2e78 100644 --- a/screen/main_menu.cpp +++ b/screen/main_menu.cpp @@ -39,6 +39,6 @@ void drawMainMenu(GameState &gs){ } } ui::DrawTextV("Happy Cirno Day", {22, 20}, 22, ColorAlpha(YELLOW, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1))); - ui::DrawTextV("A short story by\nsamosagaming69 (Odia\ntwinky boy) &\nsilli_chilli", {22, 48}, 14, ColorAlpha(GREEN, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1))); + ui::DrawTextV("A short story by\nsamosagaming69 &\nsilli_chilli", {22, 48}, 14, ColorAlpha(GREEN, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1))); ui::DrawTextV("Music: Tomboyish Prelude\nAlbum: Fantasy Kaleidoscope OST\nCircle: Yuuhei Satellite\nArrangement: Iceon", {3, 323}, 12, ColorAlpha(ORANGE, Clamp(gs.timeSinceSceneChange/(SCENE_CHANGE/2.0f), 0, 1))); } |
