summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorHugues Ross <hugues.ross@gmail.com>2020-02-15 10:33:18 -0500
committerGitHub <noreply@github.com>2020-02-15 15:33:18 +0000
commit7ce21788f86d489d6dc08d9b2d3f6e3f8495b64e (patch)
treeb3388dad101a3b6b4edee239a21bdc662071faca /games
parentee7d35760242824fd6b00a6ab1d9a2e6e5873d2c (diff)
downloadminetest-7ce21788f86d489d6dc08d9b2d3f6e3f8495b64e.tar.gz
minetest-7ce21788f86d489d6dc08d9b2d3f6e3f8495b64e.tar.bz2
minetest-7ce21788f86d489d6dc08d9b2d3f6e3f8495b64e.zip
Add animated_image[] formspec element (#9258)
Diffstat (limited to 'games')
-rw-r--r--games/minimal/mods/test/formspec.lua20
-rw-r--r--games/minimal/mods/test/textures/test_animation.jpgbin0 -> 3696 bytes
-rw-r--r--games/minimal/mods/test/textures/test_animation.pngbin0 -> 1048 bytes
3 files changed, 16 insertions, 4 deletions
diff --git a/games/minimal/mods/test/formspec.lua b/games/minimal/mods/test/formspec.lua
index 67aad3b20..50c506899 100644
--- a/games/minimal/mods/test/formspec.lua
+++ b/games/minimal/mods/test/formspec.lua
@@ -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
diff --git a/games/minimal/mods/test/textures/test_animation.jpg b/games/minimal/mods/test/textures/test_animation.jpg
new file mode 100644
index 000000000..c4f125d5a
--- /dev/null
+++ b/games/minimal/mods/test/textures/test_animation.jpg
Binary files differ
diff --git a/games/minimal/mods/test/textures/test_animation.png b/games/minimal/mods/test/textures/test_animation.png
new file mode 100644
index 000000000..b58715bf8
--- /dev/null
+++ b/games/minimal/mods/test/textures/test_animation.png
Binary files differ