fixed initially displaying custom mouse cursor in upper left corner
authorHolger Schemel <info@artsoft.org>
Sat, 25 May 2019 12:39:03 +0000 (14:39 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 25 May 2019 12:39:14 +0000 (14:39 +0200)
src/anim.c
src/libgame/system.c

index e603a9d38a0e3760e616a83f623db24c2aac39d1..363c76fc7197d4c74e17f7dcf74210f38fe2e7eb 100644 (file)
@@ -880,6 +880,11 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part
     int mx = MIN(MAX(0, gfx.mouse_x), WIN_XSIZE - 1);
     int my = MIN(MAX(0, gfx.mouse_y), WIN_YSIZE - 1);
 
+    // prevent displaying off-screen custom mouse cursor in upper left corner
+    if (gfx.mouse_x == POS_OFFSCREEN &&
+       gfx.mouse_y == POS_OFFSCREEN)
+      mx = my = POS_OFFSCREEN;
+
     viewport_x = mx - part->control_info.x;
     viewport_y = my - part->control_info.y;
     viewport_width  = part->graphic_info.width;
index dc7dba8b2db2c763e19ee8cc274c38d73cc50b06..337c18dff69c877a714e96f0e00f07e6de3736f3 100644 (file)
@@ -320,8 +320,9 @@ void InitGfxOtherSettings(void)
   gfx.cursor_mode_override = CURSOR_UNDEFINED;
   gfx.cursor_mode_final = gfx.cursor_mode;
 
-  gfx.mouse_x = 0;
-  gfx.mouse_y = 0;
+  // prevent initially displaying custom mouse cursor in upper left corner
+  gfx.mouse_x = POS_OFFSCREEN;
+  gfx.mouse_y = POS_OFFSCREEN;
 }
 
 void InitTileCursorInfo(void)