| 201 | } |
| 202 | |
| 203 | void onUpdate(float /*time*/, float x, float y) override |
| 204 | { |
| 205 | m_pitch = std::clamp(2.f * x, 0.f, 2.f); |
| 206 | m_volume = std::clamp(100.f * (1.f - y), 0.f, 100.f); |
| 207 | |
| 208 | m_music.setPitch(m_pitch); |
| 209 | m_music.setVolume(m_volume); |
| 210 | |
| 211 | m_pitchText.setString("Pitch: " + std::to_string(m_pitch)); |
| 212 | m_volumeText.setString("Volume: " + std::to_string(m_volume)); |
| 213 | } |
| 214 | |
| 215 | void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override |
| 216 | { |