added volume control
This commit is contained in:
parent
ef7fffb159
commit
d7dcb2425e
|
|
@ -111,6 +111,7 @@ private:
|
||||||
int totalSpecialBricks{};
|
int totalSpecialBricks{};
|
||||||
int totalBricks{};
|
int totalBricks{};
|
||||||
int framerate{};
|
int framerate{};
|
||||||
|
float volume{10};
|
||||||
float playerSpeed{};
|
float playerSpeed{};
|
||||||
float ballRadius{};
|
float ballRadius{};
|
||||||
float ballMaxSpeed{};
|
float ballMaxSpeed{};
|
||||||
|
|
|
||||||
13
src/Game.cpp
13
src/Game.cpp
|
|
@ -49,9 +49,9 @@ Game::Game()
|
||||||
|
|
||||||
window.setFramerateLimit(framerate);
|
window.setFramerateLimit(framerate);
|
||||||
|
|
||||||
collideSound.setVolume(50);
|
collideSound.setVolume(volume);
|
||||||
brickBreakSound.setVolume(50);
|
brickBreakSound.setVolume(volume);
|
||||||
failSound.setVolume(50);
|
failSound.setVolume(volume);
|
||||||
|
|
||||||
player.pos = playerStartPos;
|
player.pos = playerStartPos;
|
||||||
playerHalfSize = playerSize / 2.f;
|
playerHalfSize = playerSize / 2.f;
|
||||||
|
|
@ -479,6 +479,13 @@ void Game::imgui()
|
||||||
ImGui::Text("R: reset game");
|
ImGui::Text("R: reset game");
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
|
|
||||||
|
if (ImGui::SliderFloat("Game Volume", &volume, 0, 100, "%.1f"))
|
||||||
|
{
|
||||||
|
collideSound.setVolume(volume);
|
||||||
|
brickBreakSound.setVolume(volume);
|
||||||
|
failSound.setVolume(volume);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Level config:");
|
ImGui::Text("Level config:");
|
||||||
if(ImGui::InputInt("Total bricks", &totalBricks))
|
if(ImGui::InputInt("Total bricks", &totalBricks))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue