1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-12-26 16:25:25 +01:00

Add alpha channel in HUD text elements (#16730)

This commit is contained in:
Zughy
2025-12-20 15:14:08 +01:00
committed by GitHub
parent 4cb32467d3
commit 0fe6827dae
2 changed files with 15 additions and 5 deletions

View File

@@ -394,9 +394,16 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
if (textfont->getType() == gui::EGFT_CUSTOM)
ttfont = static_cast<gui::CGUITTFont *>(textfont);
video::SColor color(255, (e->number >> 16) & 0xFF,
(e->number >> 8) & 0xFF,
(e->number >> 0) & 0xFF);
u32 num = e->number;
u8 alpha = (num >> 24) & 0xFF;
if (alpha == 0)
alpha = 0xFF; // Backwards compatibility
video::SColor color = video::SColor(alpha,
(num >> 16) & 0xFF,
(num >> 8) & 0xFF,
(num >> 0) & 0xFF);
EnrichedString text(unescape_string(utf8_to_wide(e->text)), color);
core::dimension2d<u32> textsize = textfont->getDimension(text.c_str());