added fields to graphics info structure to store current mouse position
authorHolger Schemel <info@artsoft.org>
Mon, 18 Mar 2019 22:53:08 +0000 (23:53 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 18 Mar 2019 22:53:08 +0000 (23:53 +0100)
src/events.c
src/libgame/system.c
src/libgame/system.h

index b94e57c5cbfbce47c600abc665a2ac96c09f3439..52595e2512fd177b4127a1bd4af4b3cf13579275 100644 (file)
@@ -74,6 +74,9 @@ static int FilterEvents(const Event *event)
   {
     ((MotionEvent *)event)->x -= video.screen_xoffset;
     ((MotionEvent *)event)->y -= video.screen_yoffset;
   {
     ((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
   }
 
   // non-motion events are directly passed to event handler functions
index 488e838e8c4b82650edbcd48caee246420f1c6d8..c7270d93f77540db4e19f1bd2392db493551e3ec 100644 (file)
@@ -317,6 +317,8 @@ void InitGfxCustomArtworkInfo(void)
 void InitGfxOtherSettings(void)
 {
   gfx.cursor_mode = CURSOR_DEFAULT;
 void InitGfxOtherSettings(void)
 {
   gfx.cursor_mode = CURSOR_DEFAULT;
+  gfx.mouse_x = 0;
+  gfx.mouse_y = 0;
 }
 
 void InitTileCursorInfo(void)
 }
 
 void InitTileCursorInfo(void)
index 51357bcea1fb338324e4ef8a46ec5955c00fdef1..40f4b4771d001e7bd365dc9cada4d1de13de02a2 100644 (file)
@@ -1111,6 +1111,7 @@ struct GfxInfo
   void (*draw_tile_cursor_function)(int);
 
   int cursor_mode;
   void (*draw_tile_cursor_function)(int);
 
   int cursor_mode;
+  int mouse_x, mouse_y;
 };
 
 struct TileCursorInfo
 };
 
 struct TileCursorInfo