#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#endif
+#ifdef _WIN32
+#include <windows.h>
+#include <winuser.h>
#endif
#if ENABLE_GLES
params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");
params.ZBufferBits = 24;
#ifdef __ANDROID__
- // clang-format off
params.PrivateData = porting::app_global;
- params.OGLES2ShaderPath = std::string(porting::path_user + DIR_DELIM + "media" +
- DIR_DELIM + "Shaders" + DIR_DELIM).c_str();
- // clang-format on
-#elif ENABLE_GLES
+#endif
+#if ENABLE_GLES
// there is no standardized path for these on desktop
std::string rel_path = std::string("client") + DIR_DELIM
+ "shaders" + DIR_DELIM + "Irrlicht";
#endif
}
-
-bool RenderingEngine::setWindowIcon()
+#ifdef _WIN32
+static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
{
-#if defined(XORG_USED)
-#if RUN_IN_PLACE
- return setXorgWindowIconFromPath(
- porting::path_share + "/misc/" PROJECT_NAME "-xorg-icon-128.png");
-#else
- // We have semi-support for reading in-place data if we are
- // compiled with RUN_IN_PLACE. Don't break with this and
- // also try the path_share location.
- return setXorgWindowIconFromPath(
- ICON_DIR "/hicolor/128x128/apps/" PROJECT_NAME ".png") ||
- setXorgWindowIconFromPath(porting::path_share + "/misc/" PROJECT_NAME
- "-xorg-icon-128.png");
-#endif
-#elif defined(_WIN32)
const video::SExposedVideoData exposedData = driver->getExposedVideoData();
- HWND hWnd; // Window handle
switch (driver->getDriverType()) {
case video::EDT_DIRECT3D8:
return false;
}
+ return true;
+}
+#endif
+
+bool RenderingEngine::setWindowIcon()
+{
+#if defined(XORG_USED)
+#if RUN_IN_PLACE
+ return setXorgWindowIconFromPath(
+ porting::path_share + "/misc/dragonfire-xorg-icon-128.png");
+#else
+ // We have semi-support for reading in-place data if we are
+ // compiled with RUN_IN_PLACE. Don't break with this and
+ // also try the path_share location.
+ return setXorgWindowIconFromPath(
+ ICON_DIR "/hicolor/128x128/apps/dragonfire.png") ||
+ setXorgWindowIconFromPath(porting::path_share + "/misc/dragonfire-xorg-icon-128.png");
+#endif
+#elif defined(_WIN32)
+ HWND hWnd; // Window handle
+ if (!getWindowHandle(driver, hWnd))
+ return false;
+
// Load the ICON from resource file
const HICON hicon = LoadIcon(GetModuleHandle(NULL),
MAKEINTRESOURCE(130) // The ID of the ICON defined in
}
#ifndef __ANDROID__
-#ifdef XORG_USED
+#if defined(XORG_USED)
static float calcDisplayDensity()
{
return cached_display_density;
}
-#else // XORG_USED
+#elif defined(_WIN32)
+
+
+static float calcDisplayDensity(irr::video::IVideoDriver *driver)
+{
+ HWND hWnd;
+ if (getWindowHandle(driver, hWnd)) {
+ HDC hdc = GetDC(hWnd);
+ float dpi = GetDeviceCaps(hdc, LOGPIXELSX);
+ ReleaseDC(hWnd, hdc);
+ return dpi / 96.0f;
+ }
+
+ /* return manually specified dpi */
+ return g_settings->getFloat("screen_dpi") / 96.0f;
+}
+
+float RenderingEngine::getDisplayDensity()
+{
+ static bool cached = false;
+ static float display_density;
+ if (!cached) {
+ display_density = calcDisplayDensity(get_video_driver());
+ cached = true;
+ }
+ return display_density;
+}
+
+#else
+
float RenderingEngine::getDisplayDensity()
{
return g_settings->getFloat("screen_dpi") / 96.0;
}
-#endif // XORG_USED
+
+#endif
v2u32 RenderingEngine::getDisplaySize()
{