From de95e676d8556155aedf9bbca5376e4520997dc8 Mon Sep 17 00:00:00 2001 From: auria Date: Sun, 31 Oct 2010 15:26:25 +0000 Subject: [PATCH] Yet improve handling of bad resolutions in config file git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6372 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/irr_driver.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 7c9a9f565..63ddf8798 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -166,6 +166,29 @@ void IrrDriver::initDevice() } // for bits=24, 16 if(m_device) break; } // for edt_types + + // if still no device, try with a standard 800x600 window size, maybe + // size is the problem + if(!m_device) + { + UserConfigParams::m_width = 800; + UserConfigParams::m_height = 600; + + m_device = createDevice(video::EDT_OPENGL, + core::dimension2d(UserConfigParams::m_width, + UserConfigParams::m_height ), + 32, //bits per pixel + UserConfigParams::m_fullscreen, + false, // stencil buffers + false, // vsync + this // event receiver + ); + if (m_device) + { + fprintf(stderr, "An invalid resolution was set in the config file, reverting to saner values\n"); + } + } + if(!m_device) { fprintf(stderr, "Couldn't initialise irrlicht device. Quitting.\n");