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:
parent
190147015d
commit
05dd698578
@ -576,6 +576,10 @@ parseArgs (int argc, char * argv[], bool & exit)
|
|||||||
{"-z", "--zoom"},
|
{"-z", "--zoom"},
|
||||||
"change the window scale (only if fullscreen is off) [1;2] (default: 1)",
|
"change the window scale (only if fullscreen is off) [1;2] (default: 1)",
|
||||||
1},
|
1},
|
||||||
|
{"legacy",
|
||||||
|
{"-l", "--legacy"},
|
||||||
|
"start the game in legacy display mode (640x480)",
|
||||||
|
0},
|
||||||
{"renderer",
|
{"renderer",
|
||||||
{"-r", "--renderer"},
|
{"-r", "--renderer"},
|
||||||
"set a renderer [auto;software;accelerated] (default: auto)",
|
"set a renderer [auto;software;accelerated] (default: auto)",
|
||||||
@ -656,6 +660,12 @@ parseArgs (int argc, char * argv[], bool & exit)
|
|||||||
g_settingsOverload |= SETTING_ZOOM;
|
g_settingsOverload |= SETTING_ZOOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args["legacy"])
|
||||||
|
{
|
||||||
|
Display::getDisplay ().setDisplaySize (LXLOGIC (), LYLOGIC ());
|
||||||
|
g_settingsOverload |= SETTING_LEGACY;
|
||||||
|
}
|
||||||
|
|
||||||
if (args["renderer"])
|
if (args["renderer"])
|
||||||
{
|
{
|
||||||
if (args["renderer"].as<std::string> () == "auto")
|
if (args["renderer"].as<std::string> () == "auto")
|
||||||
@ -729,7 +739,8 @@ DoInit (int argc, char * argv[], bool & exit)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Display::getDisplay ().readDisplaySize ();
|
if (!(g_settingsOverload & SETTING_LEGACY))
|
||||||
|
Display::getDisplay ().readDisplaySize ();
|
||||||
|
|
||||||
// Create a window.
|
// Create a window.
|
||||||
g_window = SDL_CreateWindow (
|
g_window = SDL_CreateWindow (
|
||||||
|
@ -46,6 +46,7 @@ enum Settings {
|
|||||||
SETTING_ZOOM = 1 << 4,
|
SETTING_ZOOM = 1 << 4,
|
||||||
SETTING_DRIVER = 1 << 5,
|
SETTING_DRIVER = 1 << 5,
|
||||||
SETTING_MIDI = 1 << 6,
|
SETTING_MIDI = 1 << 6,
|
||||||
|
SETTING_LEGACY = 1 << 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int g_settingsOverload;
|
extern int g_settingsOverload;
|
||||||
|
@ -31,8 +31,14 @@ Display::readDisplaySize ()
|
|||||||
if (res < 0)
|
if (res < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this->width = displayMode.w;
|
this->setDisplaySize (displayMode.w, displayMode.h);
|
||||||
this->height = displayMode.h;
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Display::setDisplaySize (Sint32 w, Sint32 h)
|
||||||
|
{
|
||||||
|
this->width = w;
|
||||||
|
this->height = h;
|
||||||
|
|
||||||
if (this->width < this->getLogicWidth ())
|
if (this->width < this->getLogicWidth ())
|
||||||
this->width = this->getLogicWidth ();
|
this->width = this->getLogicWidth ();
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
static Display & getDisplay ();
|
static Display & getDisplay ();
|
||||||
|
|
||||||
void readDisplaySize ();
|
void readDisplaySize ();
|
||||||
|
void setDisplaySize (Sint32 w, Sint32 h);
|
||||||
Sint32 getWidth ();
|
Sint32 getWidth ();
|
||||||
Sint32 getHeight ();
|
Sint32 getHeight ();
|
||||||
Sint32 getLogicWidth ();
|
Sint32 getLogicWidth ();
|
||||||
|
@ -4933,6 +4933,10 @@ CEvent::ReadInfo ()
|
|||||||
g_bFullScreen = !!info.fullScreen;
|
g_bFullScreen = !!info.fullScreen;
|
||||||
if (!(g_settingsOverload & SETTING_ZOOM))
|
if (!(g_settingsOverload & SETTING_ZOOM))
|
||||||
g_zoom = info.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);
|
fclose (file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user