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

@ -35,6 +35,10 @@ cartographer.skin = {
texture = "cartographer_simple_table_bg",
radius = 16,
},
inner_background = {
texture = "cartographer_simple_table_bg_2",
radius = 4,
},
button = {
font_color = "#694a3a",
texture = "cartographer_simple_table_button",
@ -74,6 +78,10 @@ cartographer.skin = {
texture = "cartographer_standard_table_bg",
radius = 16,
},
inner_background = {
texture = "cartographer_standard_table_bg_2",
radius = 4,
},
button = {
font_color = "#694a3a",
texture = "cartographer_simple_table_button",
@ -113,6 +121,10 @@ cartographer.skin = {
texture = "cartographer_advanced_table_bg",
radius = 16,
},
inner_background = {
texture = "cartographer_advanced_table_bg_2",
radius = 2,
},
button = {
font_color = "#1f2533",
texture = "cartographer_advanced_table_button",

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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B