Skip to content

Commit

Permalink
Added support for numpad/keypad keys
Browse files Browse the repository at this point in the history
  • Loading branch information
IamSanjid committed Oct 11, 2023
1 parent eba0e7c commit dcaa60d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion views/MainView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,24 @@ MainView::MainView() {
}
}

for (int kp_key = GLFW_KEY_KP_0; kp_key <= GLFW_KEY_KP_EQUAL; kp_key++) {
int scan_code = glfwGetKeyScancode(kp_key);
if (scan_code) {
auto str = glfwGetKeyName(kp_key, scan_code);
if (str) {
glfw_str_keys.push_back(str);
glfw_keys.push_back(scan_code);
}
scancodes_to_glfw_[scan_code] = kp_key;
}
}

glfw_str_keys.push_back("SPACE");
glfw_keys.push_back(glfwGetKeyScancode(GLFW_KEY_SPACE));

for (auto key = GLFW_KEY_COMMA; key <= GLFW_KEY_GRAVE_ACCENT; key++) {
int scan_code = glfwGetKeyScancode(key);
if (scan_code > 0) {
if (scan_code) {
auto str = glfwGetKeyName(key, scan_code);
if (str) {
glfw_str_keys.push_back(str);
Expand Down

0 comments on commit dcaa60d

Please sign in to comment.