From d2e744dab8c38ef56184251fe96293fa0f51fb9f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 26 Sep 2013 00:47:35 +0300 Subject: fix in Android and SDL2 screen size detection. --- src/graphicsmanager.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/graphicsmanager.cpp') 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); -- cgit v1.2.3-70-g09d2