Skip to content

Commit

Permalink
Replace pause and message menu by formspec ones
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Mar 5, 2014
1 parent 062de11 commit a4e2198
Show file tree
Hide file tree
Showing 14 changed files with 273 additions and 711 deletions.
4 changes: 2 additions & 2 deletions builtin/mainmenu.lua
Expand Up @@ -176,7 +176,7 @@ function update_menu()

-- handle errors
if gamedata.errormessage ~= nil then
formspec = "size[12,5.2]" ..
formspec = "size[12,5.2,true]" ..
"textarea[1,2;10,2;;ERROR: " ..
engine.formspec_escape(gamedata.errormessage) ..
";]"..
Expand Down Expand Up @@ -365,7 +365,7 @@ end

function tabbuilder.gettab()
local tsize = tabbuilder.tabsizes[tabbuilder.current_tab] or {width=12, height=5.2}
local retval = "size[" .. tsize.width .. "," .. tsize.height .. "]"
local retval = "size[" .. tsize.width .. "," .. tsize.height .. ",true]"

if tabbuilder.show_buttons then
retval = retval .. tabbuilder.tab_header()
Expand Down
2 changes: 1 addition & 1 deletion builtin/modmgr.lua
Expand Up @@ -422,7 +422,7 @@ function modmgr.dialog_configure_world()
local mod = filterlist.get_list(modmgr.modlist)[modmgr.world_config_selected_mod]

local retval =
"size[11,6.5]" ..
"size[11,6.5,true]" ..
"label[0.5,-0.25;" .. fgettext("World:") .. "]" ..
"label[1.75,-0.25;" .. worldspec.name .. "]"

Expand Down
4 changes: 2 additions & 2 deletions builtin/modstore.lua
Expand Up @@ -98,7 +98,7 @@ end
-- @function [parent=#modstore] getsuccessfuldialog
function modstore.getsuccessfuldialog()
local retval = ""
retval = retval .. "size[6,2]"
retval = retval .. "size[6,2,true]"
if modstore.lastmodentry ~= nil then
retval = retval .. "label[0,0.25;" .. fgettext("Successfully installed:") .. "]"
retval = retval .. "label[3,0.25;" .. modstore.lastmodentry.moddetails.title .. "]"
Expand Down Expand Up @@ -152,7 +152,7 @@ end
--------------------------------------------------------------------------------
-- @function [parent=#modstore] tabheader
function modstore.tabheader(tabname)
local retval = "size[12,10.25]"
local retval = "size[12,10.25,true]"
retval = retval .. "tabheader[-0.3,-0.99;modstore_tab;" ..
"Unsorted,Search;" ..
modstore.nametoindex(tabname) .. ";true;false]" ..
Expand Down
13 changes: 7 additions & 6 deletions doc/lua_api.txt
Expand Up @@ -849,7 +849,7 @@ Example stuff:

local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"invsize[8,9;]"..
"size[8,9]"..
"list[context;main;0,0;8,4;]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Chest");
Expand All @@ -861,7 +861,7 @@ meta:from_table({
main = {[1] = "default:dirt", [2] = "", [3] = "", [4] = "", [5] = "", [6] = "", [7] = "", [8] = "", [9] = "", [10] = "", [11] = "", [12] = "", [13] = "", [14] = "default:cobble", [15] = "", [16] = "", [17] = "", [18] = "", [19] = "", [20] = "default:cobble", [21] = "", [22] = "", [23] = "", [24] = "", [25] = "", [26] = "", [27] = "", [28] = "", [29] = "", [30] = "", [31] = "", [32] = ""}
},
fields = {
formspec = "invsize[8,9;]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]",
formspec = "size[8,9]list[context;main;0,0;8,4;]list[current_player;main;0,5;8,4;]",
infotext = "Chest"
}
})
Expand All @@ -876,26 +876,27 @@ examples.

Examples:
- Chest:
invsize[8,9;]
size[8,9]
list[context;main;0,0;8,4;]
list[current_player;main;0,5;8,4;]
- Furnace:
invsize[8,9;]
size[8,9]
list[context;fuel;2,3;1,1;]
list[context;src;2,1;1,1;]
list[context;dst;5,1;2,2;]
list[current_player;main;0,5;8,4;]
- Minecraft-like player inventory
invsize[8,7.5;]
size[8,7.5]
image[1,0.6;1,2;player.png]
list[current_player;main;0,3.5;8,4;]
list[current_player;craft;3,0;3,3;]
list[current_player;craftpreview;7,1;1,1;]

Elements:

size[<W>,<H>]
size[<W>,<H>,<fixed_size>]
^ Define the size of the menu in inventory slots
^ fixed_size true/false (optional)
^ deprecated: invsize[<W>,<H>;]

list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]
Expand Down
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -424,11 +424,9 @@ set(minetest_SRCS
chat.cpp
hud.cpp
guiKeyChangeMenu.cpp
guiMessageMenu.cpp
guiTextInputMenu.cpp
guiFormSpecMenu.cpp
guiTable.cpp
guiPauseMenu.cpp
guiPasswordChange.cpp
guiVolumeChange.cpp
guiDeathScreen.cpp
Expand Down

0 comments on commit a4e2198

Please sign in to comment.