Fix 6th line of infotext being cut off in half (#11456)

This commit is contained in:
Wuzzy 2021-08-23 20:13:17 +00:00 committed by GitHub
parent eea488ed75
commit 63e8224636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

@ -2100,7 +2100,9 @@ Some of the values in the key-value store are handled specially:
* `formspec`: Defines an inventory menu that is opened with the * `formspec`: Defines an inventory menu that is opened with the
'place/use' key. Only works if no `on_rightclick` was 'place/use' key. Only works if no `on_rightclick` was
defined for the node. See also [Formspec]. defined for the node. See also [Formspec].
* `infotext`: Text shown on the screen when the node is pointed at * `infotext`: Text shown on the screen when the node is pointed at.
Line-breaks will be applied automatically.
If the infotext is very long, it will be truncated.
Example: Example:
@ -7189,7 +7191,7 @@ Player properties need to be saved manually.
-- Default: false -- Default: false
infotext = "", infotext = "",
-- By default empty, text to be shown when pointed at object -- Same as infotext for nodes. Empty by default
static_save = true, static_save = true,
-- If false, never save this object statically. It will simply be -- If false, never save this object statically. It will simply be

@ -71,11 +71,14 @@ void GameUI::init()
chat_font_size, FM_Unspecified)); chat_font_size, FM_Unspecified));
} }
// At the middle of the screen
// Object infos are shown in this // Infotext of nodes and objects.
// If in debug mode, object debug infos shown here, too.
// Located on the left on the screen, below chat.
u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height; u32 chat_font_height = m_guitext_chat->getActiveFont()->getDimension(L"Ay").Height;
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() * 5 + 5) + // Size is limited; text will be truncated after 6 lines.
core::rect<s32>(0, 0, 400, g_fontengine->getTextHeight() * 6) +
v2s32(100, chat_font_height * v2s32(100, chat_font_height *
(g_settings->getU16("recent_chat_messages") + 3)), (g_settings->getU16("recent_chat_messages") + 3)),
false, true, guiroot); false, true, guiroot);