From 66b946d5c6bdbd72afd66e625a7e1d151db95c1f Mon Sep 17 00:00:00 2001 From: Savely Skresanov Date: Wed, 16 May 2012 21:43:49 +0700 Subject: [PATCH] Move SDL_GetVideoInfo before SDL_SetVideoMode so it will probably fix sizing issues for people. --- src/graphics.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/graphics.c b/src/graphics.c index 488a7b894..3916ffdf0 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -3878,6 +3878,7 @@ void render_cursor(pixel *vid, int x, int y, int t, int rx, int ry) #endif } +SDL_VideoInfo info; int sdl_opened = 0; int sdl_open(void) { @@ -3915,6 +3916,16 @@ int sdl_open(void) SDL_WM_SetCaption("The Powder Toy", "Powder Toy"); atexit(SDL_Quit); + + if(!sdl_opened) + info = *SDL_GetVideoInfo(); + + if (info.current_w<((XRES+BARSIZE)*sdl_scale) || info.current_h<((YRES+MENUSIZE)*sdl_scale)) + { + sdl_scale = 1; + screen_err = 1; + fprintf(stderr, "Can't change scale factor, because screen resolution is too small"); + } #if defined(OGLR) sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,32,SDL_OPENGL); SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1); @@ -4095,13 +4106,6 @@ int sdl_open(void) loadShaders(); } #else - SDL_VideoInfo* info = SDL_GetVideoInfo(); - if (info->current_w<((XRES+BARSIZE)*sdl_scale) || info->current_h<((YRES+MENUSIZE)*sdl_scale)) - { - sdl_scale = 1; - screen_err = 1; - fprintf(stderr, "Can't change scale factor, because screen resolution is too small"); - } #ifdef PIX16 if (kiosk_enable) sdl_scrn=SDL_SetVideoMode(XRES*sdl_scale + BARSIZE*sdl_scale,YRES*sdl_scale + MENUSIZE*sdl_scale,16,SDL_FULLSCREEN|SDL_SWSURFACE);