[nostalgia/core] Make clicks trigger 10 refreshes
This commit is contained in:
@@ -33,8 +33,20 @@ static void handleKeyPress(Context *ctx, int key) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
if (action == GLFW_PRESS) {
|
||||
handleKeyPress(ctx, key);
|
||||
}
|
||||
@@ -48,7 +60,7 @@ ox::Error initGfx(Context *ctx) noexcept {
|
||||
auto id = ctx->windowerData<GlfwImplData>();
|
||||
glfwSetErrorCallback(handleGlfwError);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
if constexpr(ox::defines::OS == ox::OS::Darwin) {
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
@@ -58,6 +70,9 @@ ox::Error initGfx(Context *ctx) noexcept {
|
||||
if (id->window == nullptr) {
|
||||
return OxError(1, "Could not open GLFW window");
|
||||
}
|
||||
glfwSetCursorPosCallback(id->window, handleGlfwCursorPosEvent);
|
||||
glfwSetMouseButtonCallback(id->window, handleGlfwMouseButtonEvent);
|
||||
glfwSetWindowSizeCallback(id->window, handleGlfwWindowResize);
|
||||
glfwSetKeyCallback(id->window, handleGlfwKeyEvent);
|
||||
glfwSetWindowUserPointer(id->window, ctx);
|
||||
glfwMakeContextCurrent(id->window);
|
||||
|
||||
Reference in New Issue
Block a user