1
0

Move GUI textures in separate folder

This commit is contained in:
Maksym H 2022-11-22 12:03:13 +02:00
parent 78d9ec0f2a
commit 9e83c219e7
31 changed files with 21 additions and 14 deletions

View File

@ -23,7 +23,8 @@ local function buttonbar_formspec(self)
end
local formspec = string.format("background9[%f,%f;%f,%f;%sside_menu_left.png;false;30]",
self.pos.x, self.pos.y - 0.1, self.size.x + 0.025, self.size.y + 0.35, defaulttexturedir_esc)
self.pos.x, self.pos.y - 0.1, self.size.x + 0.025, self.size.y + 0.35,
defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc)
for i=self.startbutton,#self.buttons,1 do
local btn_name = self.buttons[i].name
@ -59,9 +60,10 @@ local function buttonbar_formspec(self)
end
if button.cdb then
local tpath = defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc
formspec = formspec ..
"style[" .. btn_name .. ";bgimg=" .. defaulttexturedir_esc ..
"btn_download.png;bgimg_hovered=" .. defaulttexturedir_esc .. "btn_download_hover.png]" ..
"style[" .. btn_name .. ";bgimg=" .. tpath ..
"btn_download.png;bgimg_hovered=" .. tpath .. "btn_download_hover.png]" ..
("image_button[%f,%f;%f,%f;;%s;%s;true;%s]tooltip[%s;%s]"):format(
btn_pos.x, btn_pos.y, self.btn_size, self.btn_size,
@ -117,16 +119,18 @@ local function buttonbar_formspec(self)
btn_inc_pos.x, btn_inc_pos.y, btn_size.x, btn_size.y,
self.name, text_inc)
else
local tpath = defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc
formspec = formspec ..
"style[btnbar_dec_" .. self.name .. ";bgimg=" .. defaulttexturedir_esc ..
"btn_up.png;bgimg_hovered=" .. defaulttexturedir_esc .. "btn_up_hover.png]" ..
"style[btnbar_dec_" .. self.name .. ";bgimg=" .. tpath ..
"btn_up.png;bgimg_hovered=" .. tpath .. "btn_up_hover.png]" ..
("image_button[%f,%f;%f,%f;;btnbar_dec_%s;;true;false]"):format(
btn_dec_pos.x, btn_dec_pos.y, btn_size.x, btn_size.y,
self.name)
formspec = formspec ..
"style[btnbar_inc_" .. self.name .. ";bgimg=" .. defaulttexturedir_esc ..
"btn_down.png;bgimg_hovered=" .. defaulttexturedir_esc .. "btn_down_hover.png]" ..
"style[btnbar_inc_" .. self.name .. ";bgimg=" .. tpath ..
"btn_down.png;bgimg_hovered=" .. tpath .. "btn_down_hover.png]" ..
("image_button[%f,%f;%f,%f;;btnbar_inc_%s;;true;false]"):format(
btn_inc_pos.x, btn_inc_pos.y, btn_size.x, btn_size.y,
self.name)

View File

@ -69,13 +69,14 @@ end
--------------------------------------------------------------------------------
local function make_side_pane_tab(y, tab_name, tooltip, selected)
local tpath = defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc
local formspec = "style[" .. tab_name .. "_tab;bgimg=" ..
defaulttexturedir_esc .. tab_name
tpath .. tab_name
if selected then
formspec = formspec .. "_menu_selected.png]"
else
formspec = formspec .. "_menu.png;bgimg_hovered=" ..
defaulttexturedir_esc .. tab_name .. "_menu_hover.png]"
tpath .. tab_name .. "_menu_hover.png]"
end
return formspec ..
@ -92,6 +93,7 @@ local function get_formspec(self)
if self.parent == nil then
local tsize = self.tablist[self.last_tab_index].tabsize or
{width=self.width, height=self.height}
local tpath = defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc
formspec = formspec ..
string.format("size[%f,%f,%s]",tsize.width + 2,tsize.height + 1,
dump(self.fixed_size)) ..
@ -102,9 +104,9 @@ local function get_formspec(self)
tsize.height + 1.75 .. ";" .. defaulttexturedir_esc ..
"bg_common.png;false;40]" ..
"background9[12.13,1.05;0.9,2.6;" .. defaulttexturedir_esc .. "side_menu.png;false;30]" ..
"background9[12.13,1.05;0.9,2.6;" .. tpath .. "side_menu.png;false;30]" ..
make_side_pane_tab(0.9, "settings", fgettext("Settings"), name == "settings") ..
"image[12.15,2.26;0.9,0.06;" .. defaulttexturedir_esc .. "side_menu_divider.png]" ..
"image[12.15,2.26;0.9,0.06;" .. tpath .. "side_menu_divider.png]" ..
make_side_pane_tab(2.3, "authors", fgettext("Credits"), name == "credits")
end
@ -237,13 +239,13 @@ local function button_header(self)
local btn_name = self.name .. "_" .. i
toadd = toadd ..
"style[" .. btn_name .. ";padding=-10;bgimg=" .. defaulttexturedir_esc ..
texture
DIR_DELIM_esc .. "gui" .. DIR_DELIM_esc .. texture
if i == math.abs(self.last_tab_index) then
toadd = toadd .. "_selected.png;"
else
toadd = toadd .. ".png;bgimg_hovered=" .. defaulttexturedir_esc ..
texture .. "_hover.png;"
DIR_DELIM_esc .. "gui" .. DIR_DELIM_esc .. texture .. "_hover.png;"
end
toadd = toadd .. "bgimg_middle=20;content_offset=0]" ..

View File

@ -314,7 +314,7 @@ function is_high_dpi()
end
--------------------------------------------------------------------------------
function btn_style(field, color)
local button_path = defaulttexturedir_esc .. "gui" .. DIR_DELIM
local button_path = defaulttexturedir_esc .. "gui" .. DIR_DELIM_esc
local btn_size = is_high_dpi() and ".x2" or ""
color = (color and "_" .. color) or ""

View File

@ -27,6 +27,7 @@ local mobile = PLATFORM == "Android" or PLATFORM == "iOS"
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
defaulttexturedir_esc = core.formspec_escape(defaulttexturedir)
DIR_DELIM_esc = core.formspec_escape(DIR_DELIM) -- for use in formspecs only
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

View File

Before

Width:  |  Height:  |  Size: 213 B

After

Width:  |  Height:  |  Size: 213 B

View File

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

View File

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 479 B

View File

Before

Width:  |  Height:  |  Size: 480 B

After

Width:  |  Height:  |  Size: 480 B

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 211 B

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

View File

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 193 B

View File

Before

Width:  |  Height:  |  Size: 73 B

After

Width:  |  Height:  |  Size: 73 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 457 B

View File

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 499 B

View File

Before

Width:  |  Height:  |  Size: 499 B

After

Width:  |  Height:  |  Size: 499 B

View File

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 335 B

View File

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

View File

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

View File

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 479 B

View File

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

View File

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B