diff options
| author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-05 11:40:20 +0100 |
|---|---|---|
| committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-09 10:48:56 +0100 |
| commit | 0ea4d7d0c45575759f5e149c4bf4a458908d1107 (patch) | |
| tree | 196e67b97b05869af274bca027687db85cde2dcc /src/script | |
| parent | 13b50f55a45b8e68a787e7793d5e6e612d95a5a0 (diff) | |
| download | minetest-0ea4d7d0c45575759f5e149c4bf4a458908d1107.tar.xz | |
Add bold and italic for HUD text elements
Diffstat (limited to 'src/script')
| -rw-r--r-- | src/script/common/c_content.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index eca0c89d1..83917f3ed 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -1925,6 +1925,9 @@ 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->bold = getboolfield_default(L, 2, "bold", false); + elem->italic = getboolfield_default(L, 2, "italic", false); + /* check for known deprecated element usage */ if ((elem->type == HUD_ELEM_STATBAR) && (elem->size == v2s32())) log_deprecated(L,"Deprecated usage of statbar without size!"); @@ -1979,6 +1982,12 @@ void push_hud_element(lua_State *L, HudElement *elem) lua_pushstring(L, elem->text2.c_str()); lua_setfield(L, -2, "text2"); + + lua_pushboolean(L, elem->bold); + lua_setfield(L, -2, "bold"); + + lua_pushboolean(L, elem->italic); + lua_setfield(L, -2, "italic"); } HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) @@ -2047,6 +2056,14 @@ HudElementStat read_hud_change(lua_State *L, HudElement *elem, void **value) elem->text2 = luaL_checkstring(L, 4); *value = &elem->text2; break; + case HUD_STAT_BOLD: + elem->bold = lua_toboolean(L, 4); + *value = &elem->bold; + break; + case HUD_STAT_ITALIC: + elem->italic = lua_toboolean(L, 4); + *value = &elem->italic; + break; } return stat; } |
