mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
toml parser update + 'toml' module is built-in now
This commit is contained in:
parent
ffdeac5c1f
commit
c94d40ab02
15 changed files with 252 additions and 178 deletions
|
|
@ -32,6 +32,12 @@ static std::unordered_map<std::string, int> keycodes {
|
|||
{"up", GLFW_KEY_UP},
|
||||
};
|
||||
|
||||
static std::unordered_map<std::string, int> mousecodes {
|
||||
{"left", GLFW_MOUSE_BUTTON_1},
|
||||
{"right", GLFW_MOUSE_BUTTON_2},
|
||||
{"middle", GLFW_MOUSE_BUTTON_3},
|
||||
};
|
||||
|
||||
void Binding::reset(inputtype type, int code) {
|
||||
this->type = type;
|
||||
this->code = code;
|
||||
|
|
@ -65,6 +71,14 @@ keycode input_util::keycode_from(const std::string& name) {
|
|||
return static_cast<keycode>(found->second);
|
||||
}
|
||||
|
||||
mousecode input_util::mousecode_from(const std::string& name) {
|
||||
const auto& found = mousecodes.find(name);
|
||||
if (found == mousecodes.end()) {
|
||||
return mousecode::UNKNOWN;
|
||||
}
|
||||
return static_cast<mousecode>(found->second);
|
||||
}
|
||||
|
||||
std::string input_util::to_string(keycode code) {
|
||||
int icode_repr = static_cast<int>(code);
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue