little cleanup and mousewheel support for skeleton

This commit is contained in:
aap
2026-04-06 01:03:14 +02:00
parent 373961bbce
commit 938330ffaa
6 changed files with 61 additions and 11 deletions

View File

@@ -182,7 +182,7 @@ mousebtn(GLFWwindow *window, int button, int action, int mods)
{
static int buttons = 0;
sk::MouseState ms;
switch(button){
case GLFW_MOUSE_BUTTON_LEFT:
if(action == GLFW_PRESS)
@@ -208,6 +208,14 @@ mousebtn(GLFWwindow *window, int button, int action, int mods)
EventHandler(MOUSEBTN, &ms);
}
static void
mousewheel(GLFWwindow *window, double x, double y)
{
sk::MouseState ms;
ms.wheelDelta = y;
EventHandler(MOUSEWHEEL, &ms);
}
int
main(int argc, char *argv[])
{
@@ -231,6 +239,7 @@ main(int argc, char *argv[])
glfwSetWindowSizeCallback(window, resize);
glfwSetCursorPosCallback(window, mousemove);
glfwSetMouseButtonCallback(window, mousebtn);
glfwSetScrollCallback(window, mousewheel);
float lastTime = glfwGetTime()*1000;
while(!sk::globals.quit && !glfwWindowShouldClose(window)){