diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-26 20:11:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 20:11:17 +0200 |
commit | b3a36f7378ea0f299cfa36c81de42e00adb7292d (patch) | |
tree | 23d056b575ff0dba8cc759cc00f732099a1f3bce /src/guiFormSpecMenu.cpp | |
parent | a8650e785df3f12efa5f8cd3c6a695fb9e22a598 (diff) | |
download | minetest-b3a36f7378ea0f299cfa36c81de42e00adb7292d.tar.xz |
Isolate irrlicht references and use a singleton (#6041)
* Add Device3D class which will contain IrrlichtDevice interface
move getSupportedVideoDrivers to Device3D
Add Device3D singleton & use it in various places
Rename Device3D to Rendering engine & add helper functions to various device pointers
More singleton work
RenderingEngine owns draw_load_screen
move draw functions to RenderingEngine
Reduce IrrlichtDevice exposure and guienvironment
RenderingEngine: Expose get_timer_time() to remove device from guiEngine
Make irrlichtdevice & scene manager less exposed
* Code style fixes
* Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine
Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly
* enum paralax => enum parallax
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r-- | src/guiFormSpecMenu.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index d721c917a..0592f4e1b 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -36,6 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include <IGUIFont.h> #include <IGUITabControl.h> #include <IGUIComboBox.h> +#include "client/renderingengine.h" #include "log.h" #include "client/tile.h" // ITextureSource #include "hud.h" // drawItemStack @@ -78,14 +79,11 @@ static unsigned int font_line_height(gui::IGUIFont *font) return font->getDimension(L"Ay").Height + font->getKerningHeight(); } -GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev, - JoystickController *joystick, - gui::IGUIElement* parent, s32 id, IMenuManager *menumgr, - Client *client, - ISimpleTextureSource *tsrc, IFormSource* fsrc, TextDest* tdst, +GUIFormSpecMenu::GUIFormSpecMenu(JoystickController *joystick, + gui::IGUIElement *parent, s32 id, IMenuManager *menumgr, + Client *client, ISimpleTextureSource *tsrc, IFormSource *fsrc, TextDest *tdst, bool remap_dbl_click) : - GUIModalMenu(dev->getGUIEnvironment(), parent, id, menumgr), - m_device(dev), + GUIModalMenu(RenderingEngine::get_gui_env(), parent, id, menumgr), m_invmgr(client), m_tsrc(tsrc), m_client(client), @@ -2054,7 +2052,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) if (mydata.explicit_size) { // compute scaling for specified form size if (m_lock) { - v2u32 current_screensize = m_device->getVideoDriver()->getScreenSize(); + v2u32 current_screensize = RenderingEngine::get_video_driver()->getScreenSize(); v2u32 delta = current_screensize - m_lockscreensize; if (current_screensize.Y > m_lockscreensize.Y) @@ -2075,7 +2073,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) } double gui_scaling = g_settings->getFloat("gui_scaling"); - double screen_dpi = porting::getDisplayDensity() * 96; + double screen_dpi = RenderingEngine::getDisplayDensity() * 96; double use_imgsize; if (m_lock) { @@ -2108,7 +2106,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize) ((5.0/4.0) * (0.5 + mydata.invsize.X)); double fity_imgsize = mydata.screensize.Y / ((15.0/13.0) * (0.85 * mydata.invsize.Y)); - double screen_dpi = porting::getDisplayDensity() * 96; + double screen_dpi = RenderingEngine::getDisplayDensity() * 96; double min_imgsize = 0.3 * screen_dpi * gui_scaling; use_imgsize = MYMAX(min_imgsize, MYMIN(prefer_imgsize, MYMIN(fitx_imgsize, fity_imgsize))); @@ -2579,7 +2577,7 @@ void GUIFormSpecMenu::drawMenu() /* TODO find way to show tooltips on touchscreen */ #ifndef HAVE_TOUCHSCREENGUI - m_pointer = m_device->getCursorControl()->getPosition(); + m_pointer = RenderingEngine::get_raw_device()->getCursorControl()->getPosition(); #endif /* |