1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Android: Improve UI scaling on smaller high-density displays (#7834)

* Android: Improve UI scaling on smaller high-density displays
This commit is contained in:
stujones11 2018-11-18 10:31:19 +00:00 committed by Loïc Blot
parent e5a37543cc
commit 3b11288989
7 changed files with 58 additions and 15 deletions

View file

@ -78,10 +78,12 @@ GUITable::GUITable(gui::IGUIEnvironment *env,
setTabStop(true);
setTabOrder(-1);
updateAbsolutePosition();
float density = RenderingEngine::getDisplayDensity();
#ifdef __ANDROID__
density = 1; // dp scaling is applied by the skin
#endif
core::rect<s32> relative_rect = m_scrollbar->getRelativePosition();
s32 width = (relative_rect.getWidth()/(2.0/3.0)) *
RenderingEngine::getDisplayDensity() *
s32 width = (relative_rect.getWidth() / (2.0 / 3.0)) * density *
g_settings->getFloat("gui_scaling");
m_scrollbar->setRelativePosition(core::rect<s32>(
relative_rect.LowerRightCorner.X-width,relative_rect.UpperLeftCorner.Y,