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

Method onUpdate

examples/sound_effects/SoundEffects.cpp:548–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546 }
547
548 void onUpdate(float time, float x, float y) override
549 {
550 m_velocity = std::clamp(150.f * (1.f - y), 0.f, 150.f);
551 m_factor = std::clamp(x, 0.f, 1.f);
552
553 m_currentVelocity.setString("Velocity: " + std::to_string(m_velocity));
554 m_currentFactor.setString("Doppler Factor: " + std::to_string(m_factor));
555
556 m_position.x = std::fmod(time, 8.f) * windowWidth / 8.f;
557
558 setPosition({m_position.x, m_position.y, 0.f});
559 setVelocity({m_velocity, 0.f, 0.f});
560 setDopplerFactor(m_factor);
561 }
562
563 void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
564 {

Callers

nothing calls this directly

Calls 2

setPositionFunction · 0.85
setStringMethod · 0.45

Tested by

no test coverage detected