From: Holger Schemel Date: Sat, 25 May 2019 12:39:03 +0000 (+0200) Subject: fixed initially displaying custom mouse cursor in upper left corner X-Git-Tag: 4.1.4.0~34 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2aaf015a5b6264a47dd1da84ee2de1164752e9c2;p=rocksndiamonds.git fixed initially displaying custom mouse cursor in upper left corner --- diff --git a/src/anim.c b/src/anim.c index e603a9d3..363c76fc 100644 --- a/src/anim.c +++ b/src/anim.c @@ -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; diff --git a/src/libgame/system.c b/src/libgame/system.c index dc7dba8b..337c18df 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -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)