1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-06-30 23:20:43 +02:00

Rework all nodes displaying text according to new font_api

This commit is contained in:
Pierre-Yves Rollo
2018-07-13 20:41:53 +02:00
parent e51afb851c
commit 8c7557e45d
8 changed files with 233 additions and 234 deletions

View File

@ -45,10 +45,14 @@ function font_api.on_display_update(pos, objref)
if entity and ndef.display_entities[entity.name] then
local def = ndef.display_entities[entity.name]
local font = font_api.get_font(meta:get_string("font") or def.font_name)
objref:set_properties({
textures={font:make_text_texture(text,
def.size.x * def.resolution.x * font.height,
def.size.y * def.resolution.y * font.height,
local maxlines = def.maxlines or 1 -- TODO:How to do w/o maxlines ?
objref:set_properties({
textures={font:make_text_texture(text,
font:get_height(maxlines) * def.size.x / def.size.y
/ (def.aspect_ratio or 1),
font:get_height(maxlines),
def.maxlines, def.halign, def.valign, def.color)},
visual_size = def.size
})