Split table background in two to handle different UI sizes better

This commit is contained in:
Hugues Ross
2020-04-19 09:33:24 -04:00
parent 12b933ea1e
commit 840c1b0105
8 changed files with 16 additions and 3 deletions

View File

@ -84,13 +84,14 @@ function fs.header(w, h, rank, tab, skin)
local data = "formspec_version[3]"
.. string.format("size[%f,%f]", w, h)
.. string.format("background9[-0.1,0;1,1;%s.png;true;%s]", skin.background.texture, tostring(skin.background.radius))
.. string.format("background9[0.0625,0.125;%f,%f;%s.png;false;%s]", w - 0.125, h - 0.25, skin.inner_background.texture, tostring(skin.inner_background.radius))
.. string.format("style_type[button;noclip=true;border=false;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png;bgimg_middle=%s;textcolor=%s]", skin.tab.texture, skin.tab.hovered_texture, skin.tab.pressed_texture, tostring(skin.tab.radius), skin.tab.font_color)
.. string.format("style[tab%d;noclip=true;border=false;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png;bgimg_middle=%s;textcolor=%s]", tab, skin.tab.selected_texture, skin.tab.selected_texture, skin.tab.selected_texture, tostring(skin.tab.radius), skin.tab.font_color)
.. string.format("button[0.25,-0.375;1.5,0.55;tab1;Materials]", tab)
.. string.format("button[1.75,-0.375;1.5,0.55;tab2;Create Map]", tab);
.. string.format("button[0.25,-0.425;1.5,0.55;tab1;Materials]", tab)
.. string.format("button[1.75,-0.425;1.5,0.55;tab2;Create Map]", tab);
if rank >= 2 then
data = data .. string.format("button[3.25,-0.375;1.5,0.55;tab3;Copy Map]", tab);
data = data .. string.format("button[3.25,-0.425;1.5,0.55;tab3;Copy Map]", tab);
end
return data .. string.format("style_type[button;border=false;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png;bgimg_middle=%s;textcolor=%s]", skin.button.texture, skin.button.hovered_texture, skin.button.pressed_texture, tostring(skin.button.radius), skin.button.font_color);