mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Hide and unhide mouse cursor via SDL on startup
This can also be made permanent by setting the environment variable SDL_NOMOUSE=1 or 0, e.g. in $home/.bashrc
This commit is contained in:
parent
762952e7ea
commit
01d5f1e085
|
@ -20,6 +20,8 @@ extern bool WINDOWED;
|
||||||
|
|
||||||
namespace Renderer
|
namespace Renderer
|
||||||
{
|
{
|
||||||
|
static bool initialCursorState;
|
||||||
|
|
||||||
unsigned int display_width = 0;
|
unsigned int display_width = 0;
|
||||||
unsigned int display_height = 0;
|
unsigned int display_height = 0;
|
||||||
|
|
||||||
|
@ -85,6 +87,9 @@ namespace Renderer
|
||||||
|
|
||||||
LOG(LogInfo) << "Created surface successfully.";
|
LOG(LogInfo) << "Created surface successfully.";
|
||||||
|
|
||||||
|
//hide mouse cursor
|
||||||
|
initialCursorState = SDL_ShowCursor(0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +103,10 @@ namespace Renderer
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(sdlScreen);
|
SDL_FreeSurface(sdlScreen);
|
||||||
sdlScreen = NULL;
|
sdlScreen = NULL;
|
||||||
|
|
||||||
|
//show mouse cursor
|
||||||
|
SDL_ShowCursor(initialCursorState);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue