| 98 | } |
| 99 | |
| 100 | static void mouseButtonCallback(GLFWwindow* pGlfwWindow, int button, int action, int modifiers) |
| 101 | { |
| 102 | MouseEvent event; |
| 103 | // Prepare the mouse data |
| 104 | MouseEvent::Type type = (action == GLFW_PRESS) ? MouseEvent::Type::ButtonDown : MouseEvent::Type::ButtonUp; |
| 105 | switch (button) |
| 106 | { |
| 107 | case GLFW_MOUSE_BUTTON_LEFT: |
| 108 | event.type = type; |
| 109 | event.button = Input::MouseButton::Left; |
| 110 | break; |
| 111 | case GLFW_MOUSE_BUTTON_MIDDLE: |
| 112 | event.type = type; |
| 113 | event.button = Input::MouseButton::Middle; |
| 114 | break; |
| 115 | case GLFW_MOUSE_BUTTON_RIGHT: |
| 116 | event.type = type; |
| 117 | event.button = Input::MouseButton::Right; |
| 118 | break; |
| 119 | default: |
| 120 | // Other keys are not supported |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | Window* pWindow = (Window*)glfwGetWindowUserPointer(pGlfwWindow); |
| 125 | if (pWindow != nullptr) |
| 126 | { |
| 127 | // Modifiers |
| 128 | event.mods = getModifierFlags(modifiers); |
| 129 | double x, y; |
| 130 | glfwGetCursorPos(pGlfwWindow, &x, &y); |
| 131 | event.pos = calcMousePos(x, y, pWindow->getMouseScale()); |
| 132 | |
| 133 | pWindow->mpCallbacks->handleMouseEvent(event); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | static void mouseWheelCallback(GLFWwindow* pGlfwWindow, double scrollX, double scrollY) |
| 138 | { |
nothing calls this directly
no test coverage detected