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:
Bim Overbohm 2013-05-24 15:08:53 +02:00
parent 762952e7ea
commit 01d5f1e085

View file

@ -20,6 +20,8 @@ extern bool WINDOWED;
namespace Renderer
{
static bool initialCursorState;
unsigned int display_width = 0;
unsigned int display_height = 0;
@ -85,6 +87,9 @@ namespace Renderer
LOG(LogInfo) << "Created surface successfully.";
//hide mouse cursor
initialCursorState = SDL_ShowCursor(0);
return true;
}
@ -98,6 +103,10 @@ namespace Renderer
{
SDL_FreeSurface(sdlScreen);
sdlScreen = NULL;
//show mouse cursor
SDL_ShowCursor(initialCursorState);
SDL_Quit();
}