Use images for next/prev buttons in Creative
This commit is contained in:
parent
93933a0d73
commit
65814542d6
@ -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]"..
|
||||
|
@ -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)
|
||||
|
BIN
mods/default/textures/ui_icon_next.png
Normal file
BIN
mods/default/textures/ui_icon_next.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 307 B |
BIN
mods/default/textures/ui_icon_prev.png
Normal file
BIN
mods/default/textures/ui_icon_prev.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 289 B |
Loading…
Reference in New Issue
Block a user