]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client/renderingengine.cpp
Touch UI support for desktop builds (#10729)
[dragonfireclient.git] / src / client / renderingengine.cpp
index 558a9dd7a0f4b2c424ec387cb1c3b58e2360270b..723865db4a6a7d69f1ecc07d19c076af04010e50 100644 (file)
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include <IrrlichtDevice.h>
-#include <irrlicht.h>
 #include "fontengine.h"
 #include "client.h"
 #include "clouds.h"
@@ -105,7 +104,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
        u32 i;
        for (i = 0; i != drivers.size(); i++) {
                if (!strcasecmp(driverstring.c_str(),
-                               RenderingEngine::getVideoDriverName(drivers[i]))) {
+                               RenderingEngine::getVideoDriverInfo(drivers[i]).name.c_str())) {
                        driverType = drivers[i];
                        break;
                }
@@ -253,7 +252,7 @@ void RenderingEngine::setupTopLevelXorgWindow(const std::string &name)
        // force a shutdown of an application if it doesn't respond to the destroy
        // window message.
 
-       verbosestream << "Client: Setting Xorg _NET_WM_PID extened window manager property"
+       verbosestream << "Client: Setting Xorg _NET_WM_PID extended window manager property"
                << std::endl;
 
        Atom NET_WM_PID = XInternAtom(x11_dpl, "_NET_WM_PID", false);
@@ -555,28 +554,15 @@ void RenderingEngine::draw_scene(video::SColor skycolor, bool show_hud,
        core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair);
 }
 
-const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type)
+const VideoDriverInfo &RenderingEngine::getVideoDriverInfo(irr::video::E_DRIVER_TYPE type)
 {
-       static const std::unordered_map<irr::video::E_DRIVER_TYPE,const std::string> driver_ids = {
-               {irr::video::EDT_NULL, "null"},
-               {irr::video::EDT_OPENGL, "opengl"},
-               {irr::video::EDT_OGLES1, "ogles1"},
-               {irr::video::EDT_OGLES2, "ogles2"},
+       static const std::unordered_map<int, VideoDriverInfo> driver_info_map = {
+               {(int)video::EDT_NULL,   {"null",   "NULL Driver"}},
+               {(int)video::EDT_OPENGL, {"opengl", "OpenGL"}},
+               {(int)video::EDT_OGLES1, {"ogles1", "OpenGL ES1"}},
+               {(int)video::EDT_OGLES2, {"ogles2", "OpenGL ES2"}},
        };
-
-       return driver_ids.at(type).c_str();
-}
-
-const char *RenderingEngine::getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
-{
-       static const std::unordered_map<irr::video::E_DRIVER_TYPE,const std::string> driver_names = {
-               {irr::video::EDT_NULL, "NULL Driver"},
-               {irr::video::EDT_OPENGL, "OpenGL"},
-               {irr::video::EDT_OGLES1, "OpenGL ES1"},
-               {irr::video::EDT_OGLES2, "OpenGL ES2"},
-       };
-
-       return driver_names.at(type).c_str();
+       return driver_info_map.at((int)type);
 }
 
 #ifndef __ANDROID__
@@ -612,7 +598,7 @@ static float calcDisplayDensity()
 float RenderingEngine::getDisplayDensity()
 {
        static float cached_display_density = calcDisplayDensity();
-       return cached_display_density;
+       return cached_display_density * g_settings->getFloat("display_density_factor");
 }
 
 #elif defined(_WIN32)
@@ -640,14 +626,14 @@ float RenderingEngine::getDisplayDensity()
                display_density = calcDisplayDensity(get_video_driver());
                cached = true;
        }
-       return display_density;
+       return display_density * g_settings->getFloat("display_density_factor");
 }
 
 #else
 
 float RenderingEngine::getDisplayDensity()
 {
-       return g_settings->getFloat("screen_dpi") / 96.0;
+       return (g_settings->getFloat("screen_dpi") / 96.0) * g_settings->getFloat("display_density_factor");
 }
 
 #endif