mtimer/system/formspec/formspec_helpers.lua
2019-02-21 21:07:35 +01:00

29 lines
851 B
Lua

local m = mtimer
local S = m.translator
mtimer.build_frame = function (width, height, title)
local formspec_frame = [[
size[+width,+height] label[0,-0.125;+title]
container[0,+position]
button_exit[+exitpos,0;+bwidth,1;exit;]]..S('Exit')..[[]
button[+mainpos,0;+bwidth,1;main_menu;]]..S('Main Menu')..[[]
button[+defaultpos,0;+bwidth,1;default;]]..S('Default')..[[]
container_end[]
]]
local width = width < 6 and 6 or width
local height = height < 2 and 2 or height
return formspec_frame:gsub('%+%a+', {
['+width'] = width,
['+height'] = height,
['+title'] = minetest.formspec_escape('[mTimer] '..title),
['+position'] = height-0.7,
['+bwidth'] = width/3,
['+exitpos'] = 0,
['+mainpos'] = width/3,
['+defaultpos'] = (width/3)*2
})
end