Add z_index parameter
This commit is contained in:
parent
eeb1325acf
commit
c02d7ba31a
1
DOCS.md
1
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 (`""`)
|
||||
|
9
api.lua
9
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user