From 6357574062edeea7adf7b5522687309001100e82 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 18 Mar 2019 23:53:08 +0100 Subject: [PATCH] added fields to graphics info structure to store current mouse position --- src/events.c | 3 +++ src/libgame/system.c | 2 ++ src/libgame/system.h | 1 + 3 files changed, 6 insertions(+) diff --git a/src/events.c b/src/events.c index b94e57c5..52595e25 100644 --- a/src/events.c +++ b/src/events.c @@ -74,6 +74,9 @@ static int FilterEvents(const Event *event) { ((MotionEvent *)event)->x -= video.screen_xoffset; ((MotionEvent *)event)->y -= video.screen_yoffset; + + gfx.mouse_x = ((MotionEvent *)event)->x; + gfx.mouse_y = ((MotionEvent *)event)->y; } // non-motion events are directly passed to event handler functions diff --git a/src/libgame/system.c b/src/libgame/system.c index 488e838e..c7270d93 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -317,6 +317,8 @@ void InitGfxCustomArtworkInfo(void) void InitGfxOtherSettings(void) { gfx.cursor_mode = CURSOR_DEFAULT; + gfx.mouse_x = 0; + gfx.mouse_y = 0; } void InitTileCursorInfo(void) diff --git a/src/libgame/system.h b/src/libgame/system.h index 51357bce..40f4b477 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1111,6 +1111,7 @@ struct GfxInfo void (*draw_tile_cursor_function)(int); int cursor_mode; + int mouse_x, mouse_y; }; struct TileCursorInfo -- 2.34.1