aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-16 02:56:10 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-16 03:02:03 +0100
commitb82049c7ad77603537d419bdd0ebebfd3f007916 (patch)
treec99ea0cc4719cef88605cbb9f05b765f46a4ce2c /include
parentdcc00b359e313166f7f155bddc5cebc336c744b7 (diff)
Window: add mouse scroll event
Diffstat (limited to 'include')
-rw-r--r--include/mgl/window/event.h22
1 files changed, 15 insertions, 7 deletions
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;
};
};