summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Swanson2014-10-19 00:38:36 -0700
committerMike Swanson2014-10-19 00:38:36 -0700
commitf8459dfd65a3b8aa0457c45516ace2db51d2845f (patch)
treef76ba3f15e9425d44d516615e601f99120b7d2ec
parenta8a5d2899a73f9830f69fe2c329d2a81e299def8 (diff)
downloadchocolate-doom-f8459dfd65a3b8aa0457c45516ace2db51d2845f.tar.gz
chocolate-doom-f8459dfd65a3b8aa0457c45516ace2db51d2845f.tar.bz2
chocolate-doom-f8459dfd65a3b8aa0457c45516ace2db51d2845f.zip
allow -geometry to specify fullscreen or windowed modes, like PrBoom
This allows strings like "640x480w" to cause the engine to run in a window, while strings like "1280x800f" cause the engine to run in fullscreen mode. This is inspired by the behavior of the PrBoom -geometry parameter.
-rw-r--r--src/i_video.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/i_video.c b/src/i_video.c
index b410a096..b7175db3 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1691,21 +1691,33 @@ void I_GraphicsCheckCommandLine(void)
//!
// @category video
- // @arg <WxY>
+ // @arg <WxY>[wf]
//
- // Specify the screen mode (when running fullscreen) or the window
- // dimensions (when running in windowed mode).
+ // Specify the dimensions of the window or fullscreen mode. An
+ // optional letter of w or f appended to the dimensions selects
+ // windowed or fullscreen mode.
i = M_CheckParmWithArgs("-geometry", 1);
if (i > 0)
{
- int w, h;
+ int w, h, s;
+ char f;
- if (sscanf(myargv[i + 1], "%ix%i", &w, &h) == 2)
+ s = sscanf(myargv[i + 1], "%ix%i%1c", &w, &h, &f);
+ if (s == 2 || s == 3)
{
screen_width = w;
screen_height = h;
+
+ if (s == 3 && f == 'f')
+ {
+ fullscreen = true;
+ }
+ else if (f == 'w')
+ {
+ fullscreen = false;
+ }
}
}