mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
fix: input F1..F25 key codes & add binding 'chunks.reload'
This commit is contained in:
parent
d316a5f818
commit
ad62b759fb
8 changed files with 18 additions and 4 deletions
|
|
@ -98,6 +98,14 @@ void Events::pollEvents() {
|
|||
}
|
||||
}
|
||||
|
||||
Binding& Events::getBinding(const std::string& name) {
|
||||
auto found = bindings.find(name);
|
||||
if (found == bindings.end()) {
|
||||
throw std::runtime_error("binding '"+name+"' does not exists");
|
||||
}
|
||||
return found->second;
|
||||
}
|
||||
|
||||
void Events::bind(const std::string& name, inputtype type, keycode code) {
|
||||
bind(name, type, static_cast<int>(code));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
static void toggleCursor();
|
||||
|
||||
static Binding& getBinding(const std::string& name);
|
||||
static void bind(const std::string& name, inputtype type, keycode code);
|
||||
static void bind(const std::string& name, inputtype type, mousecode code);
|
||||
static void bind(const std::string& name, inputtype type, int code);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void input_util::initialize() {
|
|||
keycodes[std::to_string(i)] = GLFW_KEY_0+i;
|
||||
}
|
||||
for (int i = 0; i < 25; i++) {
|
||||
keycodes["f"+std::to_string(i)] = GLFW_KEY_F1+i;
|
||||
keycodes["f"+std::to_string(i+1)] = GLFW_KEY_F1+i;
|
||||
}
|
||||
for (char i = 'a'; i <= 'z'; i++) {
|
||||
keycodes[std::string({i})] = GLFW_KEY_A-'a'+i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue