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
|
return
|
||||||
"list[detached:creative_"..player_name..";main;0.25,0.25;7,4;"..tostring(start_i).."]"..
|
"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)).."]"..
|
"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)..
|
default.ui.get_itemslot_bg(0.25, 0.25, 7,4)..
|
||||||
"image[7.25,3.25;1,1;creative_trash_icon.png]"..
|
"image[7.25,3.25;1,1;creative_trash_icon.png]"..
|
||||||
|
@ -66,16 +66,28 @@ end
|
|||||||
-- Buttons
|
-- Buttons
|
||||||
|
|
||||||
function default.ui.image_button(x, y, w, h, name, image, tooltip)
|
function default.ui.image_button(x, y, w, h, name, image, tooltip)
|
||||||
local image = minetest.formspec_escape(image)
|
local ww
|
||||||
|
if w == 1 then
|
||||||
local tt = ""
|
ww = "1w"
|
||||||
if tooltip then
|
elseif w == 2 then
|
||||||
tt = "tooltip["..name..";"..minetest.formspec_escape(tooltip).."]"
|
ww = "2w"
|
||||||
|
else
|
||||||
|
ww = "3w"
|
||||||
end
|
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..";"
|
local form = ""
|
||||||
..image..";"..name..";;;false;"..image.."]"
|
local img_inactive = "ui_button_"..ww.."_inactive.png^" .. image
|
||||||
..tt
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
function default.ui.button(x, y, w, h, name, label, noclip, tooltip)
|
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