From b82049c7ad77603537d419bdd0ebebfd3f007916 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 16 Nov 2021 02:56:10 +0100 Subject: Window: add mouse scroll event --- include/mgl/window/event.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/mgl/window/event.h b/include/mgl/window/event.h index f6bf7fd..a0d3982 100644 --- a/include/mgl/window/event.h +++ b/include/mgl/window/event.h @@ -26,11 +26,6 @@ typedef struct { bool system; } mgl_key_event; -typedef struct { - int x; /* relative to left of the window */ - int y; /* relative to the top of the window */ -} mgl_mouse_move_event; - typedef enum { MGL_BUTTON_UNKNOWN, MGL_BUTTON_LEFT, @@ -42,10 +37,21 @@ typedef enum { typedef struct { int button; /* mgl_mouse_button */ - int x; /* relative to left of the window */ - int y; /* relative to top of the window */ + int x; /* mouse position relative to left of the window */ + int y; /* mouse position relative to top of the window */ } mgl_mouse_button_event; +typedef struct { + int delta; /* positive = up, negative = down */ + int x; /* mouse position relative to left of the window */ + int y; /* mouse position relative to left of the window */ +} mgl_mouse_wheel_scroll_event; + +typedef struct { + int x; /* relative to left of the window */ + int y; /* relative to the top of the window */ +} mgl_mouse_move_event; + typedef enum { MGL_EVENT_UNKNOWN, MGL_EVENT_CLOSED, /* Window closed */ @@ -57,6 +63,7 @@ typedef enum { MGL_EVENT_KEY_RELEASED, MGL_EVENT_MOUSE_BUTTON_PRESSED, MGL_EVENT_MOUSE_BUTTON_RELEASED, + MGL_EVENT_MOUSE_WHEEL_SCROLLED, MGL_EVENT_MOUSE_MOVED } mgl_event_type; @@ -67,6 +74,7 @@ struct mgl_event { mgl_text_event text; mgl_key_event key; mgl_mouse_button_event mouse_button; + mgl_mouse_wheel_scroll_event mouse_wheel_scroll; mgl_mouse_move_event mouse_move; }; }; -- cgit v1.2.3