Fixed resolution switching closing STK. Includes a totally ugly workaround a irrlicht behaviour I don't understand
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4626 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
a0588268f7
commit
f1c9b285fa
@ -53,6 +53,7 @@ IrrDriver *irr_driver = NULL;
|
|||||||
|
|
||||||
IrrDriver::IrrDriver()
|
IrrDriver::IrrDriver()
|
||||||
{
|
{
|
||||||
|
m_res_switching = false;
|
||||||
file_manager->dropFileSystem();
|
file_manager->dropFileSystem();
|
||||||
initDevice();
|
initDevice();
|
||||||
} // IrrDriver
|
} // IrrDriver
|
||||||
@ -191,7 +192,7 @@ void IrrDriver::initDevice()
|
|||||||
//m_video_driver->enableMaterial2D();
|
//m_video_driver->enableMaterial2D();
|
||||||
#endif
|
#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...)
|
// so let's decide ourselves...)
|
||||||
m_device->getCursorControl()->setVisible(true);
|
m_device->getCursorControl()->setVisible(true);
|
||||||
m_pointer_shown = true;
|
m_pointer_shown = true;
|
||||||
@ -268,6 +269,8 @@ void IrrDriver::hidePointer()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void IrrDriver::changeResolution()
|
void IrrDriver::changeResolution()
|
||||||
{
|
{
|
||||||
|
m_res_switching = true;
|
||||||
|
|
||||||
// show black before resolution switch so we don't see OpenGL's buffer garbage during switch
|
// 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()->beginScene(true, true, video::SColor(255,100,101,140));
|
||||||
m_device->getVideoDriver()->draw2DRectangle( SColor(255, 0, 0, 0),
|
m_device->getVideoDriver()->draw2DRectangle( SColor(255, 0, 0, 0),
|
||||||
@ -298,10 +301,9 @@ void IrrDriver::changeResolution()
|
|||||||
attachment_manager -> loadModels();
|
attachment_manager -> loadModels();
|
||||||
|
|
||||||
// Re-init GUI engine
|
// Re-init GUI engine
|
||||||
IrrlichtDevice* device = irr_driver->getDevice();
|
GUIEngine::init(m_device, m_video_driver, StateManager::get());
|
||||||
video::IVideoDriver* driver = device->getVideoDriver();
|
|
||||||
GUIEngine::init(device, driver, StateManager::get());
|
|
||||||
GUIEngine::reshowCurrentScreen();
|
GUIEngine::reshowCurrentScreen();
|
||||||
|
|
||||||
} // changeResolution
|
} // changeResolution
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -764,7 +766,9 @@ void IrrDriver::update(float dt)
|
|||||||
{
|
{
|
||||||
if (!m_device->run())
|
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();
|
const bool inRace = race_manager->raceIsActive();
|
||||||
|
@ -51,6 +51,10 @@ private:
|
|||||||
/** Irrlicht race font. */
|
/** Irrlicht race font. */
|
||||||
irr::gui::IGUIFont *m_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;
|
void setAllMaterialFlags(scene::IAnimatedMesh *mesh) const;
|
||||||
std::vector<VideoMode> m_modes;
|
std::vector<VideoMode> m_modes;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user