summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-09-26 00:47:35 +0300
committerAndrei Karas <akaras@inbox.ru>2013-09-26 00:47:35 +0300
commitd2e744dab8c38ef56184251fe96293fa0f51fb9f (patch)
treeabdf55ecc8a812e31e6e12b43544ebf37f52a749 /src
parentc99095851421b65878f6ef138094560298123c57 (diff)
downloadmanaverse-d2e744dab8c38ef56184251fe96293fa0f51fb9f.tar.gz
manaverse-d2e744dab8c38ef56184251fe96293fa0f51fb9f.tar.bz2
manaverse-d2e744dab8c38ef56184251fe96293fa0f51fb9f.tar.xz
manaverse-d2e744dab8c38ef56184251fe96293fa0f51fb9f.zip
fix in Android and SDL2 screen size detection.
Diffstat (limited to 'src')
-rw-r--r--src/graphicsmanager.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index cee3e1223..de3eb5986 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -1068,7 +1068,24 @@ void GraphicsManager::detectPixelSize()
}
#if defined ANDROID
#ifdef USE_SDL2
- // +++ need add support
+ const int dpi = atoi(getenv("DISPLAY_DPI"));
+ if (dpi <= 120)
+ mDensity = 0;
+ else if (dpi <= 160)
+ mDensity = 1;
+ else if (dpi <= 213)
+ mDensity = 2;
+ else if (dpi <= 240)
+ mDensity = 3;
+ else if (dpi <= 320)
+ mDensity = 4;
+// else if (dpi <= 480)
+ else
+ mDensity = 5;
+ mMaxWidth = atoi(getenv("DISPLAY_RESOLUTION_WIDTH"));
+ mMaxHeight = atoi(getenv("DISPLAY_RESOLUTION_HEIGHT"));
+ mWidthMM = atoi(getenv("DISPLAY_WIDTH_MM"));
+ mHeightMM = atoi(getenv("DISPLAY_HEIGHT_MM"));
#else
SDL_ANDROID_GetMetrics(&mMaxWidth, &mMaxHeight,
&mWidthMM, &mHeightMM, &mDensity);