aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-07-27 19:11:46 +0200
committerGitHub <noreply@github.com>2021-07-27 19:11:46 +0200
commit6e8aebf4327ed43ade17cbe8e6cf652edc099651 (patch)
tree4977c6c9f9b0ceb92098694b4f8b990dc4b50822 /src/script/common
parentcf136914cf421ee52f6806eda2fa97740d0ee552 (diff)
downloadminetest-6e8aebf4327ed43ade17cbe8e6cf652edc099651.tar.gz
minetest-6e8aebf4327ed43ade17cbe8e6cf652edc099651.tar.bz2
minetest-6e8aebf4327ed43ade17cbe8e6cf652edc099651.zip
Add bold, italic and monospace font styling for HUD text elements (#11478)
Co-authored-by: Elias Fleckenstein <eliasfleckenstein@web.de>
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_content.cpp9
1 files changed, 9 insertions, 0 deletions
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;
}