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

Function getDescription

src/SFML/Window/Win32/InputImpl.cpp:631–651  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

629
630////////////////////////////////////////////////////////////
631String getDescription(Keyboard::Scancode code)
632{
633 // Try to translate the scan code to a consumer key
634 if (const auto consumerKeyName = sfScanToConsumerKeyName(code))
635 return *consumerKeyName;
636
637 WORD winCode = sfScanToWinScanExtended(code);
638 std::array<WCHAR, 1024> name{};
639
640 // Remap F13-F23 to values supported by GetKeyNameText
641 if ((winCode >= 0x64) && (winCode <= 0x6E))
642 winCode += 0x18;
643 // Remap F24 to value supported by GetKeyNameText
644 if (winCode == 0x76)
645 winCode = 0x87;
646
647 if (GetKeyNameText(winCode << 16, name.data(), static_cast<int>(name.size())) > 0)
648 return name.data();
649
650 return "Unknown";
651}
652
653
654////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

sfScanToConsumerKeyNameFunction · 0.85
sfScanToWinScanExtendedFunction · 0.85

Tested by

no test coverage detected