mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
settings panel moved to xml (WIP)
This commit is contained in:
parent
7cb5b2eb70
commit
9cdf3ff016
33 changed files with 254 additions and 143 deletions
31
res/layouts/pages/settings.xml.lua
Normal file
31
res/layouts/pages/settings.xml.lua
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
function create_setting(id, name, step, track_width, postfix)
|
||||
local info = core.get_setting_info(id)
|
||||
if postfix == nil then
|
||||
postfix = ""
|
||||
end
|
||||
document.settings_panel:add(gui.template("track_setting", {
|
||||
id=id,
|
||||
name=gui.str(name, "settings"),
|
||||
value=core.get_setting(id),
|
||||
min=info.min,
|
||||
max=info.max,
|
||||
step=step,
|
||||
track_width=track_width,
|
||||
postfix=postfix
|
||||
}))
|
||||
end
|
||||
|
||||
function update_setting(x, id, name, postfix)
|
||||
core.set_setting(id, x)
|
||||
-- updating label
|
||||
document[id..".L"].text = string.format(
|
||||
"%s: %s%s", name, core.str_setting(id), postfix
|
||||
)
|
||||
end
|
||||
|
||||
function on_open()
|
||||
create_setting("chunks.load-distance", "Load Distance", 1, 3)
|
||||
create_setting("chunks.load-speed", "Load Speed", 1, 1)
|
||||
create_setting("graphics.fog-curve", "Fog Curve", 0.1, 2)
|
||||
create_setting("camera.fov", "FOV", 1, 4, "°")
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue