1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Add a --legacy option for starting the game in 640x480 mode

This commit is contained in:
Mathieu Schroeter 2018-06-28 23:54:30 +02:00
parent 190147015d
commit 05dd698578
5 changed files with 26 additions and 3 deletions

View File

@ -576,6 +576,10 @@ parseArgs (int argc, char * argv[], bool & exit)
{"-z", "--zoom"},
"change the window scale (only if fullscreen is off) [1;2] (default: 1)",
1},
{"legacy",
{"-l", "--legacy"},
"start the game in legacy display mode (640x480)",
0},
{"renderer",
{"-r", "--renderer"},
"set a renderer [auto;software;accelerated] (default: auto)",
@ -656,6 +660,12 @@ parseArgs (int argc, char * argv[], bool & exit)
g_settingsOverload |= SETTING_ZOOM;
}
if (args["legacy"])
{
Display::getDisplay ().setDisplaySize (LXLOGIC (), LYLOGIC ());
g_settingsOverload |= SETTING_LEGACY;
}
if (args["renderer"])
{
if (args["renderer"].as<std::string> () == "auto")
@ -729,7 +739,8 @@ DoInit (int argc, char * argv[], bool & exit)
return EXIT_FAILURE;
}
Display::getDisplay ().readDisplaySize ();
if (!(g_settingsOverload & SETTING_LEGACY))
Display::getDisplay ().readDisplaySize ();
// Create a window.
g_window = SDL_CreateWindow (

View File

@ -46,6 +46,7 @@ enum Settings {
SETTING_ZOOM = 1 << 4,
SETTING_DRIVER = 1 << 5,
SETTING_MIDI = 1 << 6,
SETTING_LEGACY = 1 << 7,
};
extern int g_settingsOverload;

View File

@ -31,8 +31,14 @@ Display::readDisplaySize ()
if (res < 0)
return;
this->width = displayMode.w;
this->height = displayMode.h;
this->setDisplaySize (displayMode.w, displayMode.h);
}
void
Display::setDisplaySize (Sint32 w, Sint32 h)
{
this->width = w;
this->height = h;
if (this->width < this->getLogicWidth ())
this->width = this->getLogicWidth ();

View File

@ -16,6 +16,7 @@ public:
static Display & getDisplay ();
void readDisplaySize ();
void setDisplaySize (Sint32 w, Sint32 h);
Sint32 getWidth ();
Sint32 getHeight ();
Sint32 getLogicWidth ();

View File

@ -4933,6 +4933,10 @@ CEvent::ReadInfo ()
g_bFullScreen = !!info.fullScreen;
if (!(g_settingsOverload & SETTING_ZOOM))
g_zoom = info.zoom;
/* Prefer the desktop fullscreen mode by default. */
if (!(g_settingsOverload & SETTING_LEGACY) && g_bFullScreen && g_zoom == 2)
g_zoom = 1;
}
fclose (file);