Add forced fullscreen mode

This is mainly to make sure the game is definitely set to fullscreen in
Big Picture and on the Steam Deck, and to also remove windowed options
that wouldn't make sense if you're not on a desktop (toggling
fullscreen, resize to nearest). Those options would also be removed on
console and mobile too.

There's a bit of an annoying bug where if you launch the game in forced
fullscreen mode, but then exit and relaunch in normal mode, your game
will have fullscreen window sizes but it won't be fullscreen. This is
because forced fullscreen mode tries to preserve your non-forced
fullscreen setting, but due to the way window sizes are stored and
queried, it can't preserve the non-forced window size. This is a bit
difficult to work around, so I'm just putting in a FIXME here because we
can fix it later and I'd rather have a slightly buggy forced fullscreen
mode than not have one at all.

Closes #849.
This commit is contained in:
Misa
2021-12-25 22:55:55 -08:00
parent 3e36bfd56f
commit f5166c437e
6 changed files with 89 additions and 37 deletions

View File

@@ -289,9 +289,10 @@ static void menurender(void)
}
break;
case Menu::graphicoptions:
switch (game.currentmenuoption)
{
int offset = 0;
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
{
case 0:
graphics.bigprint( -1, 30, "Toggle Fullscreen", tr, tg, tb, true);
graphics.Print( -1, 65, "Change to fullscreen/windowed mode.", tr, tg, tb, true);
@@ -303,9 +304,15 @@ static void menurender(void)
{
graphics.Print( -1, 85, "Current mode: FULLSCREEN", tr, tg, tb, true);
}
break;
}
case 1:
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 1)
{
graphics.bigprint( -1, 30, "Scaling Mode", tr, tg, tb, true);
graphics.Print( -1, 65, "Choose letterbox/stretch/integer mode.", tr, tg, tb, true);
@@ -321,8 +328,9 @@ static void menurender(void)
graphics.Print( -1, 85, "Current mode: LETTERBOX", tr, tg, tb, true);
break;
}
break;
case 2:
}
if (game.currentmenuoption == offset + 2 && !gameScreen.isForcedFullscreen())
{
graphics.bigprint(-1, 30, "Resize to Nearest", tr, tg, tb, true);
graphics.Print(-1, 65, "Resize to the nearest window size", tr, tg, tb, true);
graphics.Print(-1, 75, "that is of an integer multiple.", tr, tg, tb, true);
@@ -331,8 +339,13 @@ static void menurender(void)
graphics.Print(-1, 95, "You must be in windowed mode", tr, tg, tb, true);
graphics.Print(-1, 105, "to use this option.", tr, tg, tb, true);
}
break;
case 3:
}
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 3)
{
graphics.bigprint( -1, 30, "Toggle Filter", tr, tg, tb, true);
graphics.Print( -1, 65, "Change to nearest/linear filter.", tr, tg, tb, true);
@@ -344,15 +357,17 @@ static void menurender(void)
{
graphics.Print( -1, 85, "Current mode: NEAREST", tr, tg, tb, true);
}
break;
}
case 4:
if (game.currentmenuoption == offset + 4)
{
graphics.bigprint( -1, 30, "Analogue Mode", tr, tg, tb, true);
graphics.Print( -1, 65, "There is nothing wrong with your", tr, tg, tb, true);
graphics.Print( -1, 75, "television set. Do not attempt to", tr, tg, tb, true);
graphics.Print( -1, 85, "adjust the picture.", tr, tg, tb, true);
break;
case 5:
}
if (game.currentmenuoption == offset + 5)
{
graphics.bigprint(-1, 30, "Toggle VSync", tr, tg, tb, true);
/* FIXME: Upgrade to SDL 2.0.18 and remove this ifdef when it releases! */
#if SDL_VERSION_ATLEAST(2, 0, 17)
@@ -370,9 +385,9 @@ static void menurender(void)
{
graphics.Print(-1, 85, "Current mode: VSYNC ON", tr, tg, tb, true);
}
break;
}
break;
}
case Menu::audiooptions:
switch (game.currentmenuoption)
{