From: <au...@us...> - 2010-02-03 21:47:43
|
Revision: 4626 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4626&view=rev Author: auria Date: 2010-02-03 21:47:36 +0000 (Wed, 03 Feb 2010) Log Message: ----------- Fixed resolution switching closing STK. Includes a totally ugly workaround a irrlicht behaviour I don't understand Modified Paths: -------------- main/trunk/src/graphics/irr_driver.cpp main/trunk/src/graphics/irr_driver.hpp Modified: main/trunk/src/graphics/irr_driver.cpp =================================================================== --- main/trunk/src/graphics/irr_driver.cpp 2010-02-03 01:57:12 UTC (rev 4625) +++ main/trunk/src/graphics/irr_driver.cpp 2010-02-03 21:47:36 UTC (rev 4626) @@ -53,6 +53,7 @@ IrrDriver::IrrDriver() { + m_res_switching = false; file_manager->dropFileSystem(); initDevice(); } // IrrDriver @@ -191,7 +192,7 @@ //m_video_driver->enableMaterial2D(); #endif - // set cursor viasible by default (what's the default is not tooclearly documented, + // set cursor visible by default (what's the default is not too clearly documented, // so let's decide ourselves...) m_device->getCursorControl()->setVisible(true); m_pointer_shown = true; @@ -268,6 +269,8 @@ //----------------------------------------------------------------------------- void IrrDriver::changeResolution() { + m_res_switching = true; + // show black before resolution switch so we don't see OpenGL's buffer garbage during switch m_device->getVideoDriver()->beginScene(true, true, video::SColor(255,100,101,140)); m_device->getVideoDriver()->draw2DRectangle( SColor(255, 0, 0, 0), @@ -298,10 +301,9 @@ attachment_manager -> loadModels(); // Re-init GUI engine - IrrlichtDevice* device = irr_driver->getDevice(); - video::IVideoDriver* driver = device->getVideoDriver(); - GUIEngine::init(device, driver, StateManager::get()); + GUIEngine::init(m_device, m_video_driver, StateManager::get()); GUIEngine::reshowCurrentScreen(); + } // changeResolution // ---------------------------------------------------------------------------- @@ -764,7 +766,9 @@ { if (!m_device->run()) { - main_loop->abort(); + // FIXME: I have NO idea why, after performing resolution switch, the irrlicht device asks once to be deleted + if (m_res_switching) m_res_switching = false; + else main_loop->abort(); } const bool inRace = race_manager->raceIsActive(); Modified: main/trunk/src/graphics/irr_driver.hpp =================================================================== --- main/trunk/src/graphics/irr_driver.hpp 2010-02-03 01:57:12 UTC (rev 4625) +++ main/trunk/src/graphics/irr_driver.hpp 2010-02-03 21:47:36 UTC (rev 4626) @@ -51,6 +51,10 @@ /** Irrlicht race font. */ irr::gui::IGUIFont *m_race_font; + /** Flag set during resolution switching, so that the game doesn't think it needs + * to exit because no frame is open */ + bool m_res_switching; + void setAllMaterialFlags(scene::IAnimatedMesh *mesh) const; std::vector<VideoMode> m_modes; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |