From 9b8e0280eb0389dd93184d668b3ab853a85fbd67 Mon Sep 17 00:00:00 2001 From: savask Date: Sat, 12 May 2012 17:55:38 +0700 Subject: Check screen resolution before scaling game window. diff --git a/src/graphics.c b/src/graphics.c index 1b1e8ce..281da0f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -4094,6 +4094,12 @@ 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; + 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); -- cgit v0.9.2-21-gd62e