Browse Source

Platform: Implement WheelUp/Down analog to Sdl2Application

... for better portability.

Signed-off-by: Squareys <squareys@googlemail.com>
pull/141/head
Squareys 10 years ago committed by Squareys
parent
commit
accf8380f0
  1. 6
      src/Magnum/Platform/GlfwApplication.cpp
  2. 3
      src/Magnum/Platform/GlfwApplication.h

6
src/Magnum/Platform/GlfwApplication.cpp

@ -178,6 +178,12 @@ void GlfwApplication::staticMouseEvent(GLFWwindow*, int button, int action, int)
void GlfwApplication::staticMouseScrollEvent(GLFWwindow*, double xoffset, double yoffset) {
MouseScrollEvent e(Vector2d{xoffset, yoffset});
_instance->mouseScrollEvent(e);
if(yoffset != 0.0) {
MouseEvent e1((yoffset > 0.0) ? MouseEvent::Button::WheelUp : MouseEvent::Button::WheelDown);
_instance->mousePressEvent(e);
_instance->mousePressEvent(e1);
}
}
void GlfwApplication::staticErrorCallback(int, const char* description) {

3
src/Magnum/Platform/GlfwApplication.h

@ -665,6 +665,9 @@ class GlfwApplication::MouseEvent: public GlfwApplication::InputEvent {
Button6 = GLFW_MOUSE_BUTTON_6, /**< Mouse button 6 */
Button7 = GLFW_MOUSE_BUTTON_7, /**< Mouse button 7 */
Button8 = GLFW_MOUSE_BUTTON_8, /**< Mouse button 8 */
WheelUp = GLFW_MOUSE_BUTTON_LAST + 1, /**< Mouse wheel up */
WheelDown = GLFW_MOUSE_BUTTON_LAST + 2, /**< Mouse wheel down */
};
/** @brief Button */

Loading…
Cancel
Save