Created
March 3, 2020 05:40
-
-
Save haleyjd/355f836551832e781e1cb18c4a2fafd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class YourKeys | |
{ | |
A, | |
B, | |
Subtract | |
}; | |
using keymap_t = std::unordered_map<std::string, YourKeys>; | |
const keymap_t g_theKeysDukeTheKeys = | |
{ | |
{ "A", YourKeys::A }, | |
{ "B", YourKeys::B }, | |
{ "Select", YourKeys::Select } | |
}; | |
int32_t InputManager::findBindByString(const std::string &str) | |
{ | |
if(keymap_t::const_iterator itr = g_theKeysDukeTheKeys.find(str); itr != g_theKeysDukeTheKeys.cend()) | |
{ | |
return static_cast<int32_t>(itr->second); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment