Minor GUI scaling fixes
This commit is contained in:
parent
bbd89e8332
commit
aee23e4940
@ -74,9 +74,9 @@ void GameUI::init(Client *client)
|
||||
// At the middle of the screen
|
||||
// Object infos are shown in this
|
||||
u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height;
|
||||
float scale = RenderingEngine::getDisplayDensity() * client->getHudScaling();
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
scale /= 2;
|
||||
float scale = 1.0f;
|
||||
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||
scale = RenderingEngine::getDisplayDensity() * client->getHudScaling() * 0.5f;
|
||||
#endif
|
||||
m_guitext_info = gui::StaticText::add(guienv, L"",
|
||||
core::rect<s32>(0, 0, 400, g_fontengine->getTextHeight() * 6) +
|
||||
|
@ -111,7 +111,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
*/
|
||||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
#define TTF_DEFAULT_FONT_SIZE (14)
|
||||
#define TTF_DEFAULT_FONT_SIZE (13)
|
||||
#else
|
||||
#define TTF_DEFAULT_FONT_SIZE (18)
|
||||
#endif
|
||||
|
@ -503,8 +503,13 @@ void set_default_settings()
|
||||
settings->setDefault("vsync", "true");
|
||||
|
||||
float ScaleFactor = [[NSScreen mainScreen] backingScaleFactor];
|
||||
if (ScaleFactor >= 2)
|
||||
settings->setDefault("screen_dpi", "128");
|
||||
settings->setDefault("screen_dpi", std::to_string(ScaleFactor * 72));
|
||||
if (ScaleFactor >= 2) {
|
||||
settings->setDefault("hud_scaling", "1.5");
|
||||
} else {
|
||||
settings->setDefault("hud_scaling", "1.25");
|
||||
settings->setDefault("gui_scaling", "1.5");
|
||||
}
|
||||
|
||||
// Shaders work but may reduce performance on iGPU
|
||||
settings->setDefault("enable_shaders", "false");
|
||||
@ -690,9 +695,13 @@ void set_default_settings()
|
||||
// 5.5" iPhone Plus
|
||||
settings->setDefault("hud_scaling", "0.65");
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
settings->setDefault("font_size", font_small);
|
||||
} else if (SDVersion5and8Inch || SDVersion6and1Inch || SDVersion6and5Inch) {
|
||||
// 5.8+" iPhones
|
||||
} else if (SDVersion5and8Inch || SDVersion6and1Inch) {
|
||||
// 5.8" and 6.1" iPhones
|
||||
settings->setDefault("hud_scaling", "0.8");
|
||||
settings->setDefault("mouse_sensitivity", "0.35");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if SDVersion6and5Inch {
|
||||
// 6.5" iPhone
|
||||
settings->setDefault("hud_scaling", "0.85");
|
||||
settings->setDefault("mouse_sensitivity", "0.35");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
@ -701,7 +710,6 @@ void set_default_settings()
|
||||
settings->setDefault("hud_scaling", "0.9");
|
||||
settings->setDefault("mouse_sensitivity", "0.25");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
settings->setDefault("device_is_tablet", "false");
|
||||
} else {
|
||||
// iPad
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
@ -709,14 +717,16 @@ void set_default_settings()
|
||||
}
|
||||
|
||||
// Settings for the Rounded Screen and Home Bar
|
||||
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
|
||||
UIWindow *window = UIApplication.sharedApplication.keyWindow;
|
||||
CGFloat safeAreaBottom = window.safeAreaInsets.bottom;
|
||||
|
||||
if (window.safeAreaInsets.bottom > 0) {
|
||||
settings->setDefault("hud_move_upwards", "20");
|
||||
if (SDVersioniPhone12Series)
|
||||
if (safeAreaBottom > 0) {
|
||||
settings->setDefault("hud_move_upwards", std::to_string(safeAreaBottom));
|
||||
if SDVersioniPhone12Series
|
||||
settings->setDefault("round_screen", "75");
|
||||
else
|
||||
settings->setDefault("round_screen", "35");
|
||||
}
|
||||
#endif // iOS
|
||||
#endif
|
||||
}
|
||||
|
@ -3297,12 +3297,19 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
double fitx_imgsize;
|
||||
double fity_imgsize;
|
||||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
v2f padded_screensize(
|
||||
mydata.screensize.X * 0.9f,
|
||||
mydata.screensize.Y
|
||||
);
|
||||
#else
|
||||
// Pad the screensize with 5% of the screensize on all sides to ensure
|
||||
// that even the largest formspecs don't touch the screen borders.
|
||||
v2f padded_screensize(
|
||||
mydata.screensize.X * 0.9f,
|
||||
mydata.screensize.Y * 0.9f
|
||||
);
|
||||
#endif
|
||||
|
||||
if (mydata.real_coordinates) {
|
||||
fitx_imgsize = padded_screensize.X / mydata.invsize.X;
|
||||
|
@ -121,7 +121,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
removeChildren();
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 2;
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 1.5;
|
||||
#elif defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() * 1.5;
|
||||
#else
|
||||
|
@ -76,7 +76,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
||||
Calculate new sizes and positions
|
||||
*/
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 2;
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() / 1.5;
|
||||
#elif defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
||||
const float s = m_gui_scale * RenderingEngine::getDisplayDensity() * 1.5;
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user