1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add bold, italic and monospace font styling for HUD text elements (#11478)

Co-authored-by: Elias Fleckenstein <eliasfleckenstein@web.de>
This commit is contained in:
sfan5 2021-07-27 19:11:46 +02:00 committed by GitHub
parent cf136914cf
commit 6e8aebf432
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 127 additions and 24 deletions

View file

@ -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;
}