added volume control
This commit is contained in:
parent
ef7fffb159
commit
d7dcb2425e
|
|
@ -111,6 +111,7 @@ private:
|
|||
int totalSpecialBricks{};
|
||||
int totalBricks{};
|
||||
int framerate{};
|
||||
float volume{10};
|
||||
float playerSpeed{};
|
||||
float ballRadius{};
|
||||
float ballMaxSpeed{};
|
||||
|
|
|
|||
13
src/Game.cpp
13
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))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue