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

Function isKeyPressedImpl

src/SFML/Window/Unix/KeyboardImpl.cpp:582–597  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

580
581////////////////////////////////////////////////////////////
582bool isKeyPressedImpl(KeyCode keycode)
583{
584 if (keycode != nullKeyCode)
585 {
586 const auto display = sf::priv::openDisplay();
587
588 // Get the whole keyboard state
589 std::array<char, 32> keys{};
590 XQueryKeymap(display.get(), keys.data());
591
592 // Check our keycode
593 return (keys[keycode / 8] & (1 << (keycode % 8))) != 0;
594 }
595
596 return false;
597}
598
599} // anonymous namespace
600

Callers 1

isKeyPressedMethod · 0.85

Calls 2

openDisplayFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected