HUD interpolation, and a POI marker test
This commit is contained in:
parent
ba17b7f195
commit
889aa531ba
7 changed files with 393 additions and 4 deletions
46
mods/rgt_ui/init.lua
Normal file
46
mods/rgt_ui/init.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
-- The purpose of this module is to abstract away element theming in formspecs.
|
||||
-- While formspecs themselves are a good UI format, custom theming can become
|
||||
-- troublesome, especially when it needs to be added into every single formspec.
|
||||
-- This module also abstracts away the construction of some more complex widgets.
|
||||
|
||||
ui = {}
|
||||
local ns = ui
|
||||
|
||||
function ns.headers(w, h)
|
||||
return "formspec_version[10]\
|
||||
size["..w..","..h.."]\
|
||||
"
|
||||
end
|
||||
|
||||
function ns.container(x --[[Float]], y --[[Float]], body --[[String]]) --> String
|
||||
return string.format("container[%f,%f]\
|
||||
%s\
|
||||
container_end[]\
|
||||
", x, y, body)
|
||||
end
|
||||
|
||||
-- Note: This automatically creates the container's associated scrollbar, just in case scrollbar theming is ever added.
|
||||
function ns.scroll_container(x, y, width, height, name, orientation, factor, padding, body)
|
||||
return string.format("scroll_container[%f,%f;%f,%f;%s;%s;%s;%s]\
|
||||
%s\
|
||||
scroll_container_end[]\
|
||||
%s\
|
||||
", x, y, width, height, name or "", orientation or "", factor and tostring(factor) or "", padding or "", ns.scrollbar(x +width -0.25, y, 0.25, height, name, orientation))
|
||||
end
|
||||
|
||||
function ns.scrollbar(x, y, width, height, name, value, main, max, smallstep, largestep, thumbsize, arrows)
|
||||
local out = string.format("scrollbar[%f,%f;%f,%f;%s;%s]", x, y, width, height, name, value and tostring(value) or "")
|
||||
return out
|
||||
end
|
||||
|
||||
function ns.label(x --[[FLoat]], y --[[Float]], text --[[String]]) --> String
|
||||
return string.format("label[%f,%f;%s]\n", x, y, text)
|
||||
end
|
||||
|
||||
function ns.button(x --[[Float]], y --[[Float]], width --[[Float]], height --[[Float]], name --[[String?]], label --[[String?]]) --> String
|
||||
return string.format("button[%f,%f;%f,%f;%s;%s]\n", x, y, name or "", label or "")
|
||||
end
|
||||
|
||||
local function show_test_view()
|
||||
ui.begin()
|
||||
end
|
||||
2
mods/rgt_ui/mod.conf
Normal file
2
mods/rgt_ui/mod.conf
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
name = rgt_ui
|
||||
depends = rgt_base
|
||||
Loading…
Add table
Add a link
Reference in a new issue