Hide cursor if we failed to set our 1 pix transparent cursor

SDL_ShowCursor() can take SDL_ENABLE / SDL_DISABLE or SDL_QUERY
This commit is contained in:
Thomas BERNARD 2017-12-21 01:18:05 +01:00 committed by Thomas Bernard
parent 2928a16e41
commit e36cff0fef

View File

@ -96,11 +96,19 @@ void Set_mode_SDL(int *width, int *height, int fullscreen)
// Trick borrowed to Barrage (http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg737265.html) :
// Showing the cursor but setting it to fully transparent allows us to get absolute mouse coordinates,
// this means we can use tablet in fullscreen mode.
SDL_ShowCursor(1); // Hide the SDL mouse cursor, we use our own
SDL_FreeCursor(cur);
cur = SDL_CreateCursor(&cursorData, &cursorData, 1,1,0,0);
SDL_SetCursor(cur);
if (cur != NULL)
{
SDL_SetCursor(cur);
SDL_ShowCursor(SDL_ENABLE); // show the SDL 1 pixel transparent cursor
}
else
{
// failed to create the 1 pixel transparent cursor
SDL_ShowCursor(SDL_DISABLE); // Hide the SDL mouse cursor, we use our own internal one
}
}
#if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED)