| 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 | { |
nothing calls this directly
no test coverage detected