aboutsummaryrefslogtreecommitdiff
path: root/src/gui/guiEngine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/guiEngine.cpp')
-rw-r--r--src/gui/guiEngine.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gui/guiEngine.cpp b/src/gui/guiEngine.cpp
index b40707d01..93463ad70 100644
--- a/src/gui/guiEngine.cpp
+++ b/src/gui/guiEngine.cpp
@@ -75,8 +75,6 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
if (name.empty())
return NULL;
- m_to_delete.insert(name);
-
#if ENABLE_GLES
video::ITexture *retval = m_driver->findTexture(name.c_str());
if (retval)
@@ -88,6 +86,7 @@ video::ITexture *MenuTextureSource::getTexture(const std::string &name, u32 *id)
image = Align2Npot2(image, m_driver);
retval = m_driver->addTexture(name.c_str(), image);
+ m_to_delete.insert(name);
image->drop();
return retval;
#else
@@ -170,6 +169,7 @@ GUIEngine::GUIEngine(JoystickController *joystick,
m_menumanager,
NULL /* &client */,
m_texture_source,
+ m_sound_manager,
m_formspecgui,
m_buttonhandler,
"",
@@ -297,10 +297,14 @@ void GUIEngine::run()
driver->endScene();
+ IrrlichtDevice *device = RenderingEngine::get_raw_device();
+ u32 frametime_min = 1000 / (device->isWindowFocused()
+ ? g_settings->getFloat("fps_max")
+ : g_settings->getFloat("fps_max_unfocused"));
if (m_clouds_enabled)
- cloudPostProcess();
+ cloudPostProcess(frametime_min, device);
else
- sleep_ms(25);
+ sleep_ms(frametime_min);
m_script->step();
@@ -367,9 +371,8 @@ void GUIEngine::cloudPreProcess()
}
/******************************************************************************/
-void GUIEngine::cloudPostProcess()
+void GUIEngine::cloudPostProcess(u32 frametime_min, IrrlichtDevice *device)
{
- float fps_max = g_settings->getFloat("pause_fps_max");
// Time of frame without fps limit
u32 busytime_u32;
@@ -380,12 +383,10 @@ void GUIEngine::cloudPostProcess()
else
busytime_u32 = 0;
- // FPS limiter
- u32 frametime_min = 1000./fps_max;
-
+ // FPS limit
if (busytime_u32 < frametime_min) {
u32 sleeptime = frametime_min - busytime_u32;
- RenderingEngine::get_raw_device()->sleep(sleeptime);
+ device->sleep(sleeptime);
}
}
@@ -484,8 +485,6 @@ void GUIEngine::drawHeader(video::IVideoDriver *driver)
splashrect += v2s32((screensize.Width/2)-(splashsize.X/2),
((free_space/2)-splashsize.Y/2)+10);
- video::SColor bgcolor(255,50,50,50);
-
draw2DImageFilterScaled(driver, texture, splashrect,
core::rect<s32>(core::position2d<s32>(0,0),
core::dimension2di(texture->getOriginalSize())),