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

Method handle

examples/keyboard/Keyboard.cpp:359–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 }
358
359 void handle(const sf::Event& event)
360 {
361 // React to keyboard events by starting an animation
362 if (const auto* keyPressed = event.getIf<sf::Event::KeyPressed>())
363 {
364 if (keyPressed->scancode != sf::Keyboard::Scan::Unknown)
365 m_moveFactors[static_cast<std::size_t>(keyPressed->scancode)] = 1.f;
366 }
367 else if (const auto* keyReleased = event.getIf<sf::Event::KeyReleased>())
368 {
369 if (keyReleased->scancode != sf::Keyboard::Scan::Unknown)
370 m_moveFactors[static_cast<std::size_t>(keyReleased->scancode)] = -1.f;
371 }
372 }
373
374 void update(sf::Time frameTime)
375 {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected