MCPcopy Create free account
hub / github.com/Hopson97/HopsonCraft / loadKeybindingsFromStream

Method loadKeybindingsFromStream

Source/Util/Config.cpp:75–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void Config::loadKeybindingsFromStream(ConfigParser& parser)
76{
77 while (parser.atKVP()) {
78 auto kvp = parser.getKVP();
79 if (kvp.first == "Player_Forwards")
80 {
81 m_keybindings[Key_Binds::Control::Player_Forwards] = static_cast<sf::Keyboard::Key>(std::stoi(kvp.second));
82 }
83 else if (kvp.first == "Player_Back")
84 {
85 m_keybindings[Key_Binds::Control::Player_Back] = static_cast<sf::Keyboard::Key>(std::stoi(kvp.second));
86 }
87 else if (kvp.first == "Player_Left")
88 {
89 m_keybindings[Key_Binds::Control::Player_Left] = static_cast<sf::Keyboard::Key>(std::stoi(kvp.second));
90 }
91 else if (kvp.first == "Player_Right")
92 {
93 m_keybindings[Key_Binds::Control::Player_Right] = static_cast<sf::Keyboard::Key>(std::stoi(kvp.second));
94 }
95 else
96 {
97 parser.error("Unrecognised key \"" + kvp.first + "\"");
98 }
99 }
100}
101

Callers

nothing calls this directly

Calls 3

atKVPMethod · 0.80
getKVPMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected