mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-05 02:39:41 +01:00
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:
parent
3e36bfd56f
commit
f5166c437e
6 changed files with 89 additions and 37 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Exit.h"
|
||||
#include "Graphics.h"
|
||||
#include "Maths.h"
|
||||
#include "Screen.h"
|
||||
#include "Unused.h"
|
||||
#include "UtilityClass.h"
|
||||
#include "Vlogging.h"
|
||||
|
@ -1061,11 +1062,7 @@ static int PLATFORM_getOSDirectory(char* output, const size_t output_size)
|
|||
|
||||
bool FILESYSTEM_openDirectoryEnabled(void)
|
||||
{
|
||||
/* This is just a check to see if we're on a desktop or tenfoot setup.
|
||||
* If you're working on a tenfoot-only build, add a def that always
|
||||
* returns false!
|
||||
*/
|
||||
return !SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE);
|
||||
return !gameScreen.isForcedFullscreen();
|
||||
}
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
|
|
|
@ -6035,9 +6035,15 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
maxspacing = 15;
|
||||
break;
|
||||
case Menu::graphicoptions:
|
||||
if (!gameScreen.isForcedFullscreen())
|
||||
{
|
||||
option("toggle fullscreen");
|
||||
}
|
||||
option("scaling mode");
|
||||
if (!gameScreen.isForcedFullscreen())
|
||||
{
|
||||
option("resize to nearest", gameScreen.isWindowed);
|
||||
}
|
||||
option("toggle filter");
|
||||
option("toggle analogue");
|
||||
option("toggle vsync");
|
||||
|
|
|
@ -605,19 +605,29 @@ static void menuactionpress(void)
|
|||
map.nexttowercolour();
|
||||
break;
|
||||
case Menu::graphicoptions:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
int offset = 0;
|
||||
bool processed = false;
|
||||
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -289,9 +289,10 @@ static void menurender(void)
|
|||
}
|
||||
break;
|
||||
case Menu::graphicoptions:
|
||||
switch (game.currentmenuoption)
|
||||
{
|
||||
case 0:
|
||||
int offset = 0;
|
||||
if (game.currentmenuoption == offset + 0 && !gameScreen.isForcedFullscreen())
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ void Screen::ResizeScreen(int x, int y)
|
|||
resY = y;
|
||||
}
|
||||
|
||||
if(!isWindowed)
|
||||
if (!isWindowed || isForcedFullscreen())
|
||||
{
|
||||
int result = SDL_SetWindowFullscreen(m_window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||
if (result != 0)
|
||||
|
@ -360,3 +360,14 @@ void Screen::toggleVSync(void)
|
|||
SDL_RenderSetVSync(m_renderer, (int) vsync);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FIXME: Launching in forced fullscreen then exiting and relaunching in normal
|
||||
* mode will result in the window having fullscreen size but being windowed. */
|
||||
bool Screen::isForcedFullscreen(void)
|
||||
{
|
||||
/* This is just a check to see if we're on a desktop or tenfoot setup.
|
||||
* If you're working on a tenfoot-only build, add a def that always
|
||||
* returns true!
|
||||
*/
|
||||
return SDL_GetHintBoolean("SteamTenfoot", SDL_FALSE);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
void toggleLinearFilter(void);
|
||||
void toggleVSync(void);
|
||||
|
||||
bool isForcedFullscreen(void);
|
||||
|
||||
bool isWindowed;
|
||||
bool isFiltered;
|
||||
bool badSignalEffect;
|
||||
|
|
Loading…
Reference in a new issue