MCPcopy Create free account
hub / github.com/SFML/SFML / onUpdate

Method onUpdate

examples/sound_effects/SoundEffects.cpp:203–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

setPitchMethod · 0.80
setVolumeMethod · 0.80
setStringMethod · 0.45

Tested by

no test coverage detected