diff --git a/DOCS.md b/DOCS.md index 24ed913..746f62a 100644 --- a/DOCS.md +++ b/DOCS.md @@ -13,6 +13,7 @@ The parameters it takes are the following: * `position`: the panel position (as in any other HUD) * `alignment`: same * `offset`: same +* `z_index`: as in the Minetest HUD API * `bg`: the picture to put in the background * `bg_scale`: its scaling * `title`: the default text. Default is empty (`""`) diff --git a/api.lua b/api.lua index b4acc39..cf6d6a5 100644 --- a/api.lua +++ b/api.lua @@ -21,6 +21,7 @@ Panel = { alignment = { x = 0, y = 0 }, offset = {x = 0, y = 0}, text = "panel_bg.png", + z_index = 0 }, title_def = { hud_elem_type = "text", @@ -29,7 +30,8 @@ Panel = { offset = {x = 0, y = 0}, size = { x = 1 }, number = 0xFFFFFF, - text = "" + text = "", + z_index = 0 }, sub_img_elems = {}, -- KEY: ID, VALUE: name @@ -81,6 +83,11 @@ function Panel:new(name, def) panel.title_def.offset = def.offset end + if def.z_index then + panel.background_def.z_index = def.z_index + panel.title_def.z_index = def.z_index + end + if def.bg then panel.background_def.text = def.bg end