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

Method forEachKey

examples/keyboard/Keyboard.cpp:426–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424 // Template to iterate on scancodes and the corresponding computed rectangle in local coordinates
425 template <typename F>
426 void forEachKey(F function) const
427 {
428 sf::Vector2f position;
429 for (const auto& [cells, marginBottom] : m_matrix)
430 {
431 for (const auto& [scancode, size, marginRight] : cells)
432 {
433 function(scancode, sf::FloatRect(position, size));
434 position.x += size.x + marginRight;
435 }
436 position.x = 0.f;
437 position.y += keySize + marginBottom;
438 }
439 }
440
441 static constexpr float keySize = 54.f;
442 static constexpr float padding = 4.f;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected