mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
remove settings-related functions from core
This commit is contained in:
parent
5260062181
commit
a6301c8837
14 changed files with 119 additions and 120 deletions
|
|
@ -10,14 +10,14 @@ tostring_overrides["display.framerate"] = function(x)
|
|||
end
|
||||
|
||||
function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
||||
local info = core.get_setting_info(id)
|
||||
local info = app.get_setting_info(id)
|
||||
postfix = postfix or ""
|
||||
tooltip = tooltip or ""
|
||||
changeonrelease = changeonrelease or ""
|
||||
document.root:add(gui.template("track_setting", {
|
||||
id=id,
|
||||
name=gui.str(name, "settings"),
|
||||
value=core.get_setting(id),
|
||||
value=app.get_setting(id),
|
||||
min=info.min,
|
||||
max=info.max,
|
||||
step=step,
|
||||
|
|
@ -25,7 +25,7 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
|
|||
tooltip=tooltip,
|
||||
changeonrelease=changeonrelease
|
||||
}))
|
||||
update_setting(core.get_setting(id), id, name, postfix)
|
||||
update_setting(app.get_setting(id), id, name, postfix)
|
||||
end
|
||||
|
||||
function update_setting(x, id, name, postfix)
|
||||
|
|
@ -34,13 +34,13 @@ function update_setting(x, id, name, postfix)
|
|||
if func then
|
||||
str = func(x)
|
||||
else
|
||||
str = core.str_setting(id)
|
||||
str = app.str_setting(id)
|
||||
end
|
||||
-- updating label
|
||||
document[id..".L"].text = string.format(
|
||||
"%s: %s%s",
|
||||
gui.str(name, "settings"),
|
||||
str,
|
||||
"%s: %s%s",
|
||||
gui.str(name, "settings"),
|
||||
str,
|
||||
postfix
|
||||
)
|
||||
end
|
||||
|
|
@ -48,8 +48,8 @@ end
|
|||
function create_checkbox(id, name, tooltip)
|
||||
tooltip = tooltip or ''
|
||||
document.root:add(string.format(
|
||||
"<checkbox consumer='function(x) core.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
|
||||
id, core.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
|
||||
"<checkbox consumer='function(x) app.set_setting(\"%s\", x) end' checked='%s' tooltip='%s'>%s</checkbox>",
|
||||
id, app.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
|
||||
))
|
||||
end
|
||||
|
||||
|
|
@ -59,11 +59,11 @@ function on_open()
|
|||
create_setting("display.framerate", "Framerate", 1, "", "", true)
|
||||
|
||||
document.root:add(string.format(
|
||||
"<select context='settings' onselect='function(opt) core.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..
|
||||
"<select context='settings' onselect='function(opt) app.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..
|
||||
"<option value='0'>@Windowed</option>"..
|
||||
"<option value='1'>@Fullscreen</option>"..
|
||||
"<option value='2'>@Borderless</option>"..
|
||||
"</select>", core.get_setting("display.window-mode"))
|
||||
"</select>", app.get_setting("display.window-mode"))
|
||||
)
|
||||
|
||||
create_checkbox("camera.shaking", "Camera Shaking")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue