Add graphics option to toggle mouse cursor

Adds an option to show or hide the system mouse cursor over the game window.
This commit is contained in:
Allison Fleischer
2020-01-28 23:17:13 -08:00
committed by Ethan Lee
parent 5afba66d2e
commit 03a4c3362a
5 changed files with 47 additions and 2 deletions

View File

@@ -4448,6 +4448,11 @@ void Game::loadstats( mapclass& map, Graphics& dwgfx )
dwgfx.translucentroomname = atoi(pText);
}
if (pKey == "showmousecursor")
{
dwgfx.showmousecursor = atoi(pText);
}
if (pKey == "flipButton")
{
SDL_GameControllerButton newButton;
@@ -4496,6 +4501,14 @@ void Game::loadstats( mapclass& map, Graphics& dwgfx )
}
dwgfx.screenbuffer->ResizeScreen(width, height);
if (dwgfx.showmousecursor == true)
{
SDL_ShowCursor(SDL_ENABLE);
}
else {
SDL_ShowCursor(SDL_DISABLE);
}
if (controllerButton_flip.size() < 1)
{
controllerButton_flip.push_back(SDL_CONTROLLER_BUTTON_A);
@@ -4665,6 +4678,10 @@ void Game::savestats( mapclass& _map, Graphics& _dwgfx )
msg->LinkEndChild(new TiXmlText(tu.String((int) _dwgfx.translucentroomname).c_str()));
dataNode->LinkEndChild(msg);
msg = new TiXmlElement("showmousecursor");
msg->LinkEndChild(new TiXmlText(tu.String((int)_dwgfx.showmousecursor).c_str()));
dataNode->LinkEndChild(msg);
for (size_t i = 0; i < controllerButton_flip.size(); i += 1)
{
msg = new TiXmlElement("flipButton");
@@ -6888,9 +6905,11 @@ void Game::createmenu( std::string t )
menuoptionsactive[2] = true;
menuoptions[3] = "toggle analogue";
menuoptionsactive[3] = true;
menuoptions[4] = "return";
menuoptions[4] = "toggle mouse";
menuoptionsactive[4] = true;
nummenuoptions = 5;
menuoptions[5] = "return";
menuoptionsactive[5] = true;
nummenuoptions = 6;
menuxoff = -50;
menuyoff = 8;
/* Old stuff, not used anymore