diff --git a/src/Client/Raylib/Audio/Audio.cpp b/src/Client/Raylib/Audio/Audio.cpp index fe09c2a1..c752750e 100644 --- a/src/Client/Raylib/Audio/Audio.cpp +++ b/src/Client/Raylib/Audio/Audio.cpp @@ -39,6 +39,11 @@ namespace Raylib { SetSoundVolume(_sound, volume); } + bool Sound::isReady() const + { + return IsSoundReady(_sound); + } + void Sound::unload() { UnloadSound(_sound); @@ -115,7 +120,7 @@ namespace Raylib { bool Music::isReady() const { - return IsMusicStreamPlaying(_music); + return IsMusicReady(_music); } void Music::play() const diff --git a/src/Client/Raylib/Audio/Audio.hpp b/src/Client/Raylib/Audio/Audio.hpp index b9f3e63c..8c09a51d 100644 --- a/src/Client/Raylib/Audio/Audio.hpp +++ b/src/Client/Raylib/Audio/Audio.hpp @@ -21,6 +21,7 @@ namespace Raylib { class Sound { public: Sound(const std::string& fileName, float volume = 0.5f); + bool isReady() const; void unload(); void play() const; void stop() const; diff --git a/src/ECS/Systems/Systems.cpp b/src/ECS/Systems/Systems.cpp index 880f93eb..6c967b92 100644 --- a/src/ECS/Systems/Systems.cpp +++ b/src/ECS/Systems/Systems.cpp @@ -137,8 +137,8 @@ namespace Systems { constexpr int enemyDamage = 1; constexpr int playerHealth = 5; constexpr int playerHealth2 = 5; - constexpr float musicVolume = 0.02F; - constexpr float soundVolume = 0.1F; + constexpr float musicVolume = 0.10F; + constexpr float soundVolume = 0.13F; constexpr float fontScale = 2.0F; const float playerWidth = 25.0F; const float playerHeight = 25.0F; @@ -196,10 +196,6 @@ namespace Systems { {std::nullopt}); Registry::getInstance().setToFrontLayers(id); - Registry::getInstance().getComponents().insertBack( - {musicPath, musicVolume}); - Registry::getInstance().getComponents().insertBack( - {soundPath, soundVolume}); Registry::getInstance().getComponents().insertBack( {"Press SPACE to play music, ENTER to play sound, J to reset " "scene, ARROWS to move", @@ -213,6 +209,14 @@ namespace Systems { SystemManagersDirector::getInstance() .getSystemManager(managerId) .removeSystem(systemId); + + Registry::getInstance().setToFrontLayers(id); + + Registry::getInstance().addEntity(); + Registry::getInstance().getComponents().insertBack( + {musicPath, musicVolume}); + Registry::getInstance().getComponents().insertBack( + {soundPath, soundVolume}); } std::vector> getECSSystems()