[nostalgia/core/glfw] Cleanup and add Escape button

This commit is contained in:
Gary Talent 2022-07-21 02:16:05 -05:00
parent d2d9aae9d5
commit fd89a9abb0
2 changed files with 5 additions and 2 deletions

View File

@ -44,6 +44,7 @@ static void handleKeyPress(Context *ctx, int key, bool down) noexcept {
map[GLFW_KEY_RIGHT_CONTROL] = Key::Mod_Ctrl;
map[GLFW_KEY_LEFT_SUPER] = Key::Mod_Super;
map[GLFW_KEY_RIGHT_SUPER] = Key::Mod_Super;
map[GLFW_KEY_ESCAPE] = Key::Escape;
return map;
}();
const auto eventHandler = keyEventHandler(ctx);
@ -70,7 +71,7 @@ static void handleGlfwCursorPosEvent(GLFWwindow*, double, double) noexcept {
static void handleGlfwMouseButtonEvent(GLFWwindow *window, int, int, int) noexcept {
const auto ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
ctx->uninterruptedRefreshes = 10;
ctx->uninterruptedRefreshes = 15;
}
static void handleGlfwWindowResize(GLFWwindow*, int, int) noexcept {
@ -78,7 +79,7 @@ static void handleGlfwWindowResize(GLFWwindow*, int, int) noexcept {
static void handleGlfwKeyEvent(GLFWwindow *window, int key, int, int action, int) noexcept {
const auto ctx = static_cast<Context*>(glfwGetWindowUserPointer(window));
ctx->uninterruptedRefreshes = 2;
ctx->uninterruptedRefreshes = 15;
if (action == GLFW_PRESS) {
handleKeyPress(ctx, key, true);
} else if (action == GLFW_RELEASE) {

View File

@ -64,6 +64,8 @@ enum Key {
Mod_Super,
Mod_Shift,
Escape,
End
};