[nostalgia/core/glfw] Cleanup and add Escape button
This commit is contained in:
parent
d2d9aae9d5
commit
fd89a9abb0
@ -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) {
|
||||
|
@ -64,6 +64,8 @@ enum Key {
|
||||
Mod_Super,
|
||||
Mod_Shift,
|
||||
|
||||
Escape,
|
||||
|
||||
End
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user