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

@@ -605,19 +605,29 @@ static void menuactionpress(void)
map.nexttowercolour();
break;
case Menu::graphicoptions:
switch (game.currentmenuoption)
{
int offset = 0;
bool processed = false;
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
{
case 0:
processed = true;
music.playef(11);
gameScreen.toggleFullScreen();
game.savestatsandsettings_menu();
break;
case 1:
}
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 1)
{
processed = true;
music.playef(11);
gameScreen.toggleScalingMode();
game.savestatsandsettings_menu();
break;
case 2:
}
if (game.currentmenuoption == offset + 2 && !gameScreen.isForcedFullscreen())
{
processed = true;
// resize to nearest multiple
if (gameScreen.isWindowed)
{
@@ -629,19 +639,29 @@ static void menuactionpress(void)
{
music.playef(2);
}
break;
case 3:
}
if (gameScreen.isForcedFullscreen())
{
--offset;
}
if (game.currentmenuoption == offset + 3)
{
processed = true;
music.playef(11);
gameScreen.toggleLinearFilter();
game.savestatsandsettings_menu();
break;
case 4:
}
if (game.currentmenuoption == offset + 4)
{
processed = true;
//change smoothing
music.playef(11);
gameScreen.badSignalEffect= !gameScreen.badSignalEffect;
game.savestatsandsettings_menu();
break;
case 5:
}
if (game.currentmenuoption == offset + 5)
{
processed = true;
/* FIXME: Upgrade to SDL 2.0.18 and remove this ifdef when it releases! */
#if SDL_VERSION_ATLEAST(2, 0, 17)
//toggle vsync
@@ -649,15 +669,16 @@ static void menuactionpress(void)
gameScreen.toggleVSync();
game.savestatsandsettings_menu();
#endif
break;
default:
}
if (!processed)
{
//back
music.playef(11);
game.returnmenu();
map.nexttowercolour();
break;
}
break;
}
case Menu::youwannaquit:
switch (game.currentmenuoption)
{