Use images for next/prev buttons in Creative

This commit is contained in:
Wuzzy 2019-10-23 10:30:10 +02:00
parent 93933a0d73
commit 65814542d6
4 changed files with 23 additions and 10 deletions

View File

@ -95,8 +95,9 @@ creative.get_creative_formspec = function(player, start_i, pagenum)
return
"list[detached:creative_"..player_name..";main;0.25,0.25;7,4;"..tostring(start_i).."]"..
"label[7.5,0.75;"..F(S("@1/@2", pagenum, pagemax)).."]"..
default.ui.button(7.25, 1.25, 1, 1, "creative_prev", "<<")..
default.ui.button(7.25, 2.25, 1, 1, "creative_next", ">>")..
default.ui.image_button(7.25, 1.25, 1, 1, "creative_prev", "ui_icon_prev.png")..
default.ui.image_button(7.25, 2.25, 1, 1, "creative_next", "ui_icon_next.png")..
default.ui.get_itemslot_bg(0.25, 0.25, 7,4)..
"image[7.25,3.25;1,1;creative_trash_icon.png]"..

View File

@ -66,16 +66,28 @@ end
-- Buttons
function default.ui.image_button(x, y, w, h, name, image, tooltip)
local image = minetest.formspec_escape(image)
local tt = ""
if tooltip then
tt = "tooltip["..name..";"..minetest.formspec_escape(tooltip).."]"
local ww
if w == 1 then
ww = "1w"
elseif w == 2 then
ww = "2w"
else
ww = "3w"
end
local tooltip = tooltip or ""
local img_active = "[combine:16x16:0,0=ui_button_"..ww.."_active.png:0,1="..image
return "image_button["..x..","..y..";"..w..","..h..";"
..image..";"..name..";;;false;"..image.."]"
..tt
local form = ""
local img_inactive = "ui_button_"..ww.."_inactive.png^" .. image
form = form .. "image_button["..x..","..y..";1,1;"
..minetest.formspec_escape(img_inactive)
..";"..name..";;true;false;"
..minetest.formspec_escape(img_active).."]"
form = form .. "tooltip["..name..";"..minetest.formspec_escape(tooltip).."]"
return form
end
function default.ui.button(x, y, w, h, name, label, noclip, tooltip)

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B