1
0

Improve InfoText positioning on the screen

This commit is contained in:
mckaygerhard 2024-06-02 04:22:52 -04:00
parent bf186d81b1
commit 64ddc4065a

View File

@ -74,14 +74,14 @@ void GameUI::init(Client *client)
// At the middle of the screen // At the middle of the screen
// Object infos are shown in this // Object infos are shown in this
u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height; u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height;
float scale = 1.0f; v2u32 screensize = RenderingEngine::get_instance()->getWindowSize();
#if defined(__ANDROID__) || defined(__APPLE__) s32 text_height = g_fontengine->getTextHeight() * 6;
scale = RenderingEngine::getDisplayDensity() * client->getHudScaling() * 0.5f; s32 top_y = (screensize.Y - text_height) / 2;
#endif s32 horiz_offset = 100 + client->getRoundScreen();
m_guitext_info = gui::StaticText::add(guienv, L"", m_guitext_info = gui::StaticText::add(guienv, L"",
core::rect<s32>(0, 0, 400, g_fontengine->getTextHeight() * 6) + core::rect<s32>(horiz_offset, top_y,
v2s32(100 + client->getRoundScreen(), horiz_offset + 400, top_y + text_height),
chat_font_height * (g_settings->getU16("recent_chat_messages") + 3) * scale),
false, true, guiroot); false, true, guiroot);
// Status text (displays info when showing and hiding GUI stuff, etc.) // Status text (displays info when showing and hiding GUI stuff, etc.)