From 7ce21788f86d489d6dc08d9b2d3f6e3f8495b64e Mon Sep 17 00:00:00 2001 From: Hugues Ross Date: Sat, 15 Feb 2020 10:33:18 -0500 Subject: Add animated_image[] formspec element (#9258) --- games/minimal/mods/test/formspec.lua | 20 ++++++++++++++++---- games/minimal/mods/test/textures/test_animation.jpg | Bin 0 -> 3696 bytes games/minimal/mods/test/textures/test_animation.png | Bin 0 -> 1048 bytes 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 games/minimal/mods/test/textures/test_animation.jpg create mode 100644 games/minimal/mods/test/textures/test_animation.png (limited to 'games') 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 Binary files /dev/null and b/games/minimal/mods/test/textures/test_animation.jpg 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 Binary files /dev/null and b/games/minimal/mods/test/textures/test_animation.png differ -- cgit v1.2.3