From 6e8aebf4327ed43ade17cbe8e6cf652edc099651 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 27 Jul 2021 19:11:46 +0200 Subject: Add bold, italic and monospace font styling for HUD text elements (#11478) Co-authored-by: Elias Fleckenstein --- src/script/common/c_content.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/script/common/c_content.cpp') diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index a0b45982a..235016be0 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1928,6 +1928,8 @@ void read_hud_element(lua_State *L, HudElement *elem) elem->world_pos = lua_istable(L, -1) ? read_v3f(L, -1) : v3f(); lua_pop(L, 1); + elem->style = getintfield_default(L, 2, "style", 0); + /* check for known deprecated element usage */ if ((elem->type == HUD_ELEM_STATBAR) && (elem->size == v2s32())) log_deprecated(L,"Deprecated usage of statbar without size!"); @@ -1982,6 +1984,9 @@ void push_hud_element(lua_State *L, HudElement *elem) lua_pushstring(L, elem->text2.c_str()); lua_setfield(L, -2, "text2"); + + lua_pushinteger(L, elem->style); + lua_setfield(L, -2, "style"); } HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) @@ -2050,6 +2055,10 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) elem->text2 = luaL_checkstring(L, 4); *value = &elem->text2; break; + case HUD_STAT_STYLE: + elem->style = luaL_checknumber(L, 4); + *value = &elem->style; + break; } return stat; } -- cgit v1.2.3