diff --git a/include/Game.h b/include/Game.h index d7c258a..601e983 100644 --- a/include/Game.h +++ b/include/Game.h @@ -111,6 +111,7 @@ private: int totalSpecialBricks{}; int totalBricks{}; int framerate{}; + float volume{10}; float playerSpeed{}; float ballRadius{}; float ballMaxSpeed{}; diff --git a/src/Game.cpp b/src/Game.cpp index a1702c3..ce31eae 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -49,9 +49,9 @@ Game::Game() window.setFramerateLimit(framerate); - collideSound.setVolume(50); - brickBreakSound.setVolume(50); - failSound.setVolume(50); + collideSound.setVolume(volume); + brickBreakSound.setVolume(volume); + failSound.setVolume(volume); player.pos = playerStartPos; playerHalfSize = playerSize / 2.f; @@ -479,6 +479,13 @@ void Game::imgui() ImGui::Text("R: reset game"); ImGui::Unindent(); + if (ImGui::SliderFloat("Game Volume", &volume, 0, 100, "%.1f")) + { + collideSound.setVolume(volume); + brickBreakSound.setVolume(volume); + failSound.setVolume(volume); + } + ImGui::Text("Level config:"); if(ImGui::InputInt("Total bricks", &totalBricks)) {