From: Holger Schemel Date: Mon, 18 Mar 2019 22:53:08 +0000 (+0100) Subject: added fields to graphics info structure to store current mouse position X-Git-Tag: 4.1.3.0~30 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=6357574062edeea7adf7b5522687309001100e82;p=rocksndiamonds.git added fields to graphics info structure to store current mouse position --- 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