From 398137422ccc026802ebd4c15c576e5e13bd4bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 30 Oct 2013 12:22:22 +0100 Subject: [PATCH] SDL: Choose a reasonable default window size for windowed mode (2x PSP) --- base/PCMain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/base/PCMain.cpp b/base/PCMain.cpp index 83ac74584c..de8be6db13 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -305,6 +305,7 @@ int main(int argc, char *argv[]) { // Make sure to request a somewhat modern GL context at least - the // latest supported by MacOSX (really, really sad...) // Requires SDL 2.0 + // We really should upgrade to SDL 2.0 soon. //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); //SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); #endif @@ -336,6 +337,12 @@ int main(int argc, char *argv[]) { if (!strcmp(argv[i],"--fullscreen")) mode |= SDL_FULLSCREEN; #endif + if ((mode & SDL_FULLSCREEN) == 0) { + // set a sensible default resolution (2x) + pixel_xres = 480 * 2; + pixel_yres = 272 * 2; + } + if (SDL_SetVideoMode(pixel_xres, pixel_yres, 0, mode) == NULL) { fprintf(stderr, "SDL SetVideoMode failed: Unable to create OpenGL screen: %s\n", SDL_GetError()); SDL_Quit();