27 tinyxml2::XMLElement *keyElement = keys->FirstChildElement(
"key");
29 m_keys[key] = SDL_GetScancodeFromName(keyElement->Attribute(
"key"));
31 if(
m_keys[key] == SDL_SCANCODE_UNKNOWN) {
32 DEBUG(
"Key '", keyElement->Attribute(
"key"),
"' not recognized");
38 keyElement = keyElement->NextSiblingElement(
"key");
44 const u8 *keyboardState = SDL_GetKeyboardState(
nullptr);
45 SDL_Scancode keyScancode =
m_keys[key];
49 return keyboardState[keyScancode];
std::map< GameKey, SDL_Scancode > m_keys
tinyxml2::XMLHandle FirstChildElement(const char *element)
void loadKeysFromFile(const std::string &filename)
u32 GameKey
Alias for game key type.
bool isKeyPressed(GameKey key)
Check if a key is pressed.