Skip to content

Commit 0ee70c4

Browse files
committed
sound waves alpha scales by sqrt(volume)
1 parent 94d96bc commit 0ee70c4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/game.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,10 @@ void Game::handleButtons(float resizeRatio) {
512512
return ret;
513513
}();
514514
if (m_muted) DrawLineEx({ FREE_SPACE + 50.f, 5.f }, { FREE_SPACE + 90.f, 45.f }, 5.f, BLACK);
515-
else DrawTextureV(soundWaves, { FREE_SPACE + 78.f, 0.f }, WHITE);
515+
else DrawTextureV(soundWaves,
516+
{ FREE_SPACE + 78.f, 0.f },
517+
{ .a=static_cast<unsigned char>(std::min(std::sqrt(m_masterVolume) * 127, 255.f)) }
518+
);
516519
DrawTextEx(GetFontDefault(), "M", { FREE_SPACE + 5.f, 5.f }, 45.f, 1e20, BLACK);
517520
}
518521
}

0 commit comments

Comments
 (0)