mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix chat lines not word wrapped correct
This commit is contained in:
parent
5ca5630a11
commit
15c7460eda
1 changed files with 10 additions and 2 deletions
12
src/game.cpp
12
src/game.cpp
|
@ -1102,8 +1102,16 @@ static void updateChat(Client& client, f32 dtime, bool show_debug,
|
||||||
if (show_debug)
|
if (show_debug)
|
||||||
chat_y += line_height;
|
chat_y += line_height;
|
||||||
|
|
||||||
core::rect<s32> rect(10, chat_y, font->getDimension(recent_chat.c_str()).Width +10,
|
// first pass to calculate height of text to be set
|
||||||
chat_y + (recent_chat_count * line_height));
|
s32 width = std::min(font->getDimension(recent_chat.c_str()).Width + 10,
|
||||||
|
porting::getWindowSize().X - 20);
|
||||||
|
core::rect<s32> rect(10, chat_y, width, chat_y + porting::getWindowSize().Y);
|
||||||
|
guitext_chat->setRelativePosition(rect);
|
||||||
|
|
||||||
|
//now use real height of text and adjust rect according to this size
|
||||||
|
rect = core::rect<s32>(10, chat_y, width,
|
||||||
|
chat_y + guitext_chat->getTextHeight());
|
||||||
|
|
||||||
|
|
||||||
guitext_chat->setRelativePosition(rect);
|
guitext_chat->setRelativePosition(rect);
|
||||||
// Don't show chat if disabled or empty or profiler is enabled
|
// Don't show chat if disabled or empty or profiler is enabled
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue