Add animated_image[] formspec element (#9258)

This commit is contained in:
Hugues Ross
2020-02-15 10:33:18 -05:00
committed by GitHub
parent ee7d357602
commit 7ce21788f8
11 changed files with 200 additions and 4 deletions

View File

@@ -12,6 +12,7 @@ local clip_fs = [[
style_type[dropdown;noclip=%c]
style_type[scrollbar;noclip=%c]
style_type[table;noclip=%c]
style_type[animated_image;noclip=%c]
label[0,0;A clipping test]
button[0,1;3,0.8;x;A clipping test]
@@ -25,6 +26,7 @@ local clip_fs = [[
scrollbar[0,9;3,0.8;horizontal;x9;3]
tablecolumns[text;text]
table[0,10;3,1;x10;one,two,three,four;1]
animated_image[0,11;3,1;test_animation.png:4,100]
]]
@@ -119,8 +121,8 @@ local style_fs = [[
local pages = {
[[
formspec_version[3]
size[12,12]
real_coordinates[true]
image_button[0,0;1,1;logo.png;;1x1]
image_button[1,0;2,2;logo.png;;2x2]
button[0,2;1,1;;1x1]
@@ -157,7 +159,7 @@ local pages = {
tabheader[6.5,0;6,0.65;name;Tab 1,Tab 2,Tab 3,Secrets;1;false;false]
]],
"size[12,12]real_coordinates[true]" ..
"formspec_version[3]size[12,12]" ..
("label[0.375,0.375;Styled - %s %s]"):format(
color("#F00", "red text"),
color("#77FF00CC", "green text")) ..
@@ -170,17 +172,27 @@ local pages = {
style_fs:gsub("one_", "two_"):gsub("style%[[^%]]+%]", ""):gsub("style_type%[[^%]]+%]", "") ..
"container_end[]",
"size[12,12]real_coordinates[true]" ..
"formspec_version[3]size[12,13]" ..
"label[0.1,0.5;Clip]" ..
"container[-2.5,1]" .. clip_fs:gsub("%%c", "false") .. "container_end[]" ..
"label[11,0.5;Noclip]" ..
"container[11.5,1]" .. clip_fs:gsub("%%c", "true") .. "container_end[]",
[[
formspec_version[3]
size[12,12]
animated_image[0.5,0.5;1,1;test_animation.png:4,100]
animated_image[1.75,0.5;1,1;test_animation.png:100,100]
animated_image[0.5,1.75;1,1;test_animation.jpg:4,100]
animated_image[3,0.5;5,2;test_animation.png:4,100]
animated_image[3,2.75;5,2;test_animation.jpg:4,100]
]]
}
local function show_test_formspec(pname, page_id)
page_id = page_id or 2
local fs = pages[page_id] .. "tabheader[0,0;6,0.65;maintabs;Real Coord,Styles,Noclip;" .. page_id .. ";false;false]"
local fs = pages[page_id] .. "tabheader[0,0;6,0.65;maintabs;Real Coord,Styles,Noclip,MiscEle;" .. page_id .. ";false;false]"
minetest.show_formspec(pname, "test:formspec", fs)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB