diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/guiEngine.cpp | 30 | ||||
-rw-r--r-- | src/gui/guiEngine.h | 3 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/gui/guiEngine.cpp b/src/gui/guiEngine.cpp index 93463ad70..0c7b96492 100644 --- a/src/gui/guiEngine.cpp +++ b/src/gui/guiEngine.cpp @@ -121,12 +121,14 @@ void MenuMusicFetcher::fetchSounds(const std::string &name, /******************************************************************************/ GUIEngine::GUIEngine(JoystickController *joystick, gui::IGUIElement *parent, + RenderingEngine *rendering_engine, IMenuManager *menumgr, MainMenuData *data, bool &kill) : + m_rendering_engine(rendering_engine), m_parent(parent), m_menumanager(menumgr), - m_smgr(RenderingEngine::get_scene_manager()), + m_smgr(rendering_engine->get_scene_manager()), m_data(data), m_kill(kill) { @@ -138,7 +140,7 @@ GUIEngine::GUIEngine(JoystickController *joystick, m_buttonhandler = new TextDestGuiEngine(this); //create texture source - m_texture_source = new MenuTextureSource(RenderingEngine::get_video_driver()); + m_texture_source = new MenuTextureSource(rendering_engine->get_video_driver()); //create soundmanager MenuMusicFetcher soundfetcher; @@ -156,7 +158,7 @@ GUIEngine::GUIEngine(JoystickController *joystick, g_fontengine->getTextHeight()); rect += v2s32(4, 0); - m_irr_toplefttext = gui::StaticText::add(RenderingEngine::get_gui_env(), + m_irr_toplefttext = gui::StaticText::add(rendering_engine->get_gui_env(), m_toplefttext, rect, false, true, 0, -1); //create formspecsource @@ -232,7 +234,7 @@ void GUIEngine::run() { // Always create clouds because they may or may not be // needed based on the game selected - video::IVideoDriver *driver = RenderingEngine::get_video_driver(); + video::IVideoDriver *driver = m_rendering_engine->get_video_driver(); cloudInit(); @@ -259,10 +261,10 @@ void GUIEngine::run() fog_pixelfog, fog_rangefog); } - while (RenderingEngine::run() && (!m_startgame) && (!m_kill)) { + while (m_rendering_engine->run() && (!m_startgame) && (!m_kill)) { const irr::core::dimension2d<u32> ¤t_screen_size = - RenderingEngine::get_video_driver()->getScreenSize(); + m_rendering_engine->get_video_driver()->getScreenSize(); // Verify if window size has changed and save it if it's the case // Ensure evaluating settings->getBool after verifying screensize // First condition is cheaper @@ -293,11 +295,11 @@ void GUIEngine::run() drawHeader(driver); drawFooter(driver); - RenderingEngine::get_gui_env()->drawAll(); + m_rendering_engine->get_gui_env()->drawAll(); driver->endScene(); - IrrlichtDevice *device = RenderingEngine::get_raw_device(); + IrrlichtDevice *device = m_rendering_engine->get_raw_device(); u32 frametime_min = 1000 / (device->isWindowFocused() ? g_settings->getFloat("fps_max") : g_settings->getFloat("fps_max_unfocused")); @@ -330,7 +332,7 @@ GUIEngine::~GUIEngine() //clean up texture pointers for (image_definition &texture : m_textures) { if (texture.texture) - RenderingEngine::get_video_driver()->removeTexture(texture.texture); + m_rendering_engine->get_video_driver()->removeTexture(texture.texture); } delete m_texture_source; @@ -350,13 +352,13 @@ void GUIEngine::cloudInit() v3f(0,0,0), v3f(0, 60, 100)); m_cloud.camera->setFarValue(10000); - m_cloud.lasttime = RenderingEngine::get_timer_time(); + m_cloud.lasttime = m_rendering_engine->get_timer_time(); } /******************************************************************************/ void GUIEngine::cloudPreProcess() { - u32 time = RenderingEngine::get_timer_time(); + u32 time = m_rendering_engine->get_timer_time(); if(time > m_cloud.lasttime) m_cloud.dtime = (time - m_cloud.lasttime) / 1000.0; @@ -377,7 +379,7 @@ void GUIEngine::cloudPostProcess(u32 frametime_min, IrrlichtDevice *device) u32 busytime_u32; // not using getRealTime is necessary for wine - u32 time = RenderingEngine::get_timer_time(); + u32 time = m_rendering_engine->get_timer_time(); if(time > m_cloud.lasttime) busytime_u32 = time - m_cloud.lasttime; else @@ -528,7 +530,7 @@ void GUIEngine::drawFooter(video::IVideoDriver *driver) bool GUIEngine::setTexture(texture_layer layer, const std::string &texturepath, bool tile_image, unsigned int minsize) { - video::IVideoDriver *driver = RenderingEngine::get_video_driver(); + video::IVideoDriver *driver = m_rendering_engine->get_video_driver(); if (m_textures[layer].texture) { driver->removeTexture(m_textures[layer].texture); @@ -595,7 +597,7 @@ void GUIEngine::updateTopLeftTextSize() rect += v2s32(4, 0); m_irr_toplefttext->remove(); - m_irr_toplefttext = gui::StaticText::add(RenderingEngine::get_gui_env(), + m_irr_toplefttext = gui::StaticText::add(m_rendering_engine->get_gui_env(), m_toplefttext, rect, false, true, 0, -1); } diff --git a/src/gui/guiEngine.h b/src/gui/guiEngine.h index eef1ad8aa..70abce181 100644 --- a/src/gui/guiEngine.h +++ b/src/gui/guiEngine.h @@ -50,6 +50,7 @@ struct image_definition { /* forward declarations */ /******************************************************************************/ class GUIEngine; +class RenderingEngine; class MainMenuScripting; class Clouds; struct MainMenuData; @@ -150,6 +151,7 @@ public: */ GUIEngine(JoystickController *joystick, gui::IGUIElement *parent, + RenderingEngine *rendering_engine, IMenuManager *menumgr, MainMenuData *data, bool &kill); @@ -188,6 +190,7 @@ private: /** update size of topleftext element */ void updateTopLeftTextSize(); + RenderingEngine *m_rendering_engine = nullptr; /** parent gui element */ gui::IGUIElement *m_parent = nullptr; /** manager to add menus to */ |