+static irr::IrrlichtDevice* device;
+
+void initIrrlicht(irr::IrrlichtDevice * _device) {
+ device = _device;
+}
+
+#ifndef SERVER
+v2u32 getWindowSize() {
+ return device->getVideoDriver()->getScreenSize();
+}
+
+#ifndef __ANDROID__
+
+float getDisplayDensity() {
+ float gui_scaling = g_settings->getFloat("gui_scaling");
+ // using Y here feels like a bug, this needs to be discussed later!
+ if (getWindowSize().Y <= 800) {
+ return (2.0/3.0) * gui_scaling;
+ }
+ if (getWindowSize().Y <= 1280) {
+ return 1.0 * gui_scaling;
+ }
+
+ return (4.0/3.0) * gui_scaling;
+}
+
+v2u32 getDisplaySize() {
+ IrrlichtDevice *nulldevice = createDevice(video::EDT_NULL);
+
+ core::dimension2d<u32> deskres = nulldevice->getVideoModeList()->getDesktopResolution();
+ nulldevice -> drop();
+
+ return deskres;
+}
+#endif
+#endif
+