to scale the title + bugfix with .is_shown()
This commit is contained in:
parent
ab6db258ae
commit
a567db7f2e
1
DOCS.md
1
DOCS.md
@ -16,6 +16,7 @@ The parameters it takes are the following:
|
||||
* `bg`: the picture to put in the background
|
||||
* `bg_scale`: its scaling
|
||||
* `title`: the default text
|
||||
* `title_size`: (table) as a multiplier, where Y is not considered. Ie. `{ x = 2}` will double up the font size
|
||||
* `title_alignment`
|
||||
* `title_offset`
|
||||
* `title_color`
|
||||
|
9
api.lua
9
api.lua
@ -21,6 +21,7 @@ Panel = {
|
||||
position = {x = 1, y = 0.5},
|
||||
alignment = {x = 0, y = 0},
|
||||
offset = {x = 0, y = 0},
|
||||
size = { x = 1 },
|
||||
number = 0xFFFFFF,
|
||||
text = "Default"
|
||||
},
|
||||
@ -74,6 +75,10 @@ function Panel:new(def)
|
||||
panel.title_def.number = def.title_color
|
||||
end
|
||||
|
||||
if def.title_size then
|
||||
panel.title_def.size = def.title_size
|
||||
end
|
||||
|
||||
if def.player then
|
||||
panel.player_name = def.player
|
||||
end
|
||||
@ -172,7 +177,7 @@ function Panel:update(def, txt_elems, img_elems)
|
||||
for elem, _ in pairs(txt_elems) do
|
||||
for k, v in pairs(txt_elems[elem]) do
|
||||
self[elem][k] = v
|
||||
if self.is_shown then
|
||||
if self.is_shown == true then
|
||||
player:hud_change(self.hud_id[elem], k, v)
|
||||
end
|
||||
end
|
||||
@ -185,7 +190,7 @@ function Panel:update(def, txt_elems, img_elems)
|
||||
for elem, _ in pairs(img_elems) do
|
||||
for k, v in pairs(img_elems[elem]) do
|
||||
self[elem][k] = v
|
||||
if self.is_shown then
|
||||
if self.is_shown == true then
|
||||
player:hud_change(self.hud_id[elem], k, v)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user