aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2021-08-23 20:13:17 +0000
committerGitHub <noreply@github.com>2021-08-23 22:13:17 +0200
commit63e8224636cec3ede1dbb8b78954a8e3a82407a5 (patch)
tree873cb7e9750e828e91cf6b61051abd4a478ad787
parenteea488ed75c9a158a398a971a16d5f7226b02f35 (diff)
downloadminetest-63e8224636cec3ede1dbb8b78954a8e3a82407a5.tar.gz
minetest-63e8224636cec3ede1dbb8b78954a8e3a82407a5.tar.bz2
minetest-63e8224636cec3ede1dbb8b78954a8e3a82407a5.zip
Fix 6th line of infotext being cut off in half (#11456)
-rw-r--r--doc/lua_api.txt6
-rw-r--r--src/client/gameui.cpp9
2 files changed, 10 insertions, 5 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 1aece31f7..327f64b21 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -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
'place/use' key. Only works if no `on_rightclick` was
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:
@@ -7189,7 +7191,7 @@ Player properties need to be saved manually.
-- Default: false
infotext = "",
- -- By default empty, text to be shown when pointed at object
+ -- Same as infotext for nodes. Empty by default
static_save = true,
-- If false, never save this object statically. It will simply be
diff --git a/src/client/gameui.cpp b/src/client/gameui.cpp
index 028052fe6..9b77cf6ff 100644
--- a/src/client/gameui.cpp
+++ b/src/client/gameui.cpp
@@ -71,11 +71,14 @@ void GameUI::init()
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;
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 *
(g_settings->getU16("recent_chat_messages") + 3)),
false, true, guiroot);