/** * \brief Determines from the savegame the low-level keyboard key where the * specified game command is mapped. * \param command A game command. * \return The keyboard key mapped to this game command in the savegame. */ InputEvent::KeyboardKey GameCommands::get_saved_keyboard_binding( Command command) const { const std::string& savegame_variable = get_keyboard_binding_savegame_variable(command); const std::string& keyboard_key_name = get_savegame().get_string(savegame_variable); return InputEvent::get_keyboard_key_by_name(keyboard_key_name); }
/** * \brief Saves the low-level keyboard command where the specified game key is * mapped. * \param command A game command. * \param keyboard_key The keyboard key to map to this game command in the * savegame. */ void GameCommands::set_saved_keyboard_binding( Command command, InputEvent::KeyboardKey keyboard_key) { const std::string& savegame_variable = get_keyboard_binding_savegame_variable(command); const std::string& keyboard_key_name = InputEvent::get_keyboard_key_name(keyboard_key); get_savegame().set_string(savegame_variable, keyboard_key_name); }
/** * \brief Determines from the savegame the low-level keyboard key where the * specified game command is mapped. * \param command A game command. * \return The keyboard key mapped to this game command in the savegame. */ InputEvent::KeyboardKey GameCommands::get_saved_keyboard_binding( GameCommand command) const { const std::string& savegame_variable = get_keyboard_binding_savegame_variable(command); const std::string& keyboard_key_name = get_savegame().get_string(savegame_variable); return name_to_enum(keyboard_key_name, InputEvent::KEY_NONE); }