diff --git a/doc/en/scripting/builtins/libgui.md b/doc/en/scripting/builtins/libgui.md
index e3c109566..53d6e4ad2 100644
--- a/doc/en/scripting/builtins/libgui.md
+++ b/doc/en/scripting/builtins/libgui.md
@@ -149,16 +149,22 @@ gui.load_document(
args: table
) -> str
--- Loads a template into the layout
+-- Loads and processes layout template from file
gui.template(
-- template name in /layouts/templates without path and extension
name: str,
-- variable table (can be used in markup)
-- * Ex:
-- * text in this case is the value from params with the text key
- params: table,
- -- table, available in events as the global variable DATA
- [optional] data: table
+ params: table
+) -> str
+
+-- Processes layout template from string
+gui.process_template(
+ -- template source code
+ source: str,
+ -- variable table (same as gui.template)
+ params: table
) -> str
```
diff --git a/doc/en/scripting/builtins/libtime.md b/doc/en/scripting/builtins/libtime.md
index 8fcd4035f..51e125e9c 100644
--- a/doc/en/scripting/builtins/libtime.md
+++ b/doc/en/scripting/builtins/libtime.md
@@ -1,13 +1,21 @@
-# *time* library
+# *time* Library
-```python
-time.uptime() -> float
+```lua
+-- Returns the time since engine startup in seconds and milliseconds.
+time.uptime() -> number
+
+-- Returns the time delta in seconds and milliseconds (time elapsed since the previous frame)
+time.delta() -> number
+
+-- Returns UTC time in seconds
+time.utc_time() -> int
+
+-- Returns local (system) time in seconds
+time.local_time() -> int
+
+-- Returns the local time offset from UTC in seconds
+time.utc_offset() -> int
+
+-- Returns high-precision time in seconds (elapsed since the engine startup).
+time.precise_time() -> number
```
-
-Returns time elapsed since the engine started.
-
-```python
-time.delta() -> float
-```
-
-Returns time elapsed since the last frame.
diff --git a/doc/ru/scripting/builtins/libgui.md b/doc/ru/scripting/builtins/libgui.md
index a744639ea..9c2eb7418 100644
--- a/doc/ru/scripting/builtins/libgui.md
+++ b/doc/ru/scripting/builtins/libgui.md
@@ -147,17 +147,23 @@ gui.load_document(
args: table -- параметры для события on_open
) -> string
--- Загружает шаблон в лояут
+-- Обрабатывает xml шаблон макета из файла
gui.template(
-- имя шаблона в /layouts/templates без пути и расширения
name: string,
-- таблица переменных (может быть использована в разметке)
-- * Пр:
-- * text в данном случае, это значение из params по ключу text
- params: table,
- -- таблица, доступная в событиях как глобальная переменная DATA
- [опционально] data: table
+ params: table
) -> string
+
+-- Обрабатывает xml шаблон макета из строки
+gui.process_template(
+ -- шаблон в виде строки
+ source: string,
+ -- таблица переменных, как в gui.template
+ params: table
+)
```
## Корневой документ
diff --git a/doc/ru/scripting/builtins/libtime.md b/doc/ru/scripting/builtins/libtime.md
index 81bae58f7..62e95892a 100644
--- a/doc/ru/scripting/builtins/libtime.md
+++ b/doc/ru/scripting/builtins/libtime.md
@@ -15,4 +15,7 @@ time.local_time() -> int
-- Возвращает смещение локального времени от UTC в секундах
time.utc_offset() -> int
+
+-- Возвращает время высокой точности в секундах. За точку отсчёта берётся запуск движка.
+time.precise_time() -> number
```
diff --git a/res/devtools/syntax/lua.toml b/res/devtools/syntax/lua.toml
index d2469d2fb..45e697bbe 100644
--- a/res/devtools/syntax/lua.toml
+++ b/res/devtools/syntax/lua.toml
@@ -8,5 +8,5 @@ multiline-string-end = "]]"
keywords = [
"and", "break", "do", "else", "elseif", "end", "false", "for", "function",
"if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true",
- "until", "while", "self", "error"
+ "until", "while", "self", "error", "require"
]
diff --git a/res/layouts/pages/settings_audio.xml.lua b/res/layouts/pages/settings_audio.xml.lua
index 1ff217534..475ccc51b 100644
--- a/res/layouts/pages/settings_audio.xml.lua
+++ b/res/layouts/pages/settings_audio.xml.lua
@@ -1,4 +1,4 @@
-function create_setting(id, name, step, postfix)
+function create_trackbar_setting(id, name, step, postfix)
local info = app.get_setting_info(id)
postfix = postfix or ""
document.root:add(gui.template("track_setting", {
@@ -10,10 +10,10 @@ function create_setting(id, name, step, postfix)
step=step,
postfix=postfix
}))
- update_setting(app.get_setting(id), id, name, postfix)
+ update_trackbar_label(app.get_setting(id), id, name, postfix)
end
-function update_setting(x, id, name, postfix)
+function update_trackbar_label(x, id, name, postfix)
app.set_setting(id, x)
-- updating label
document[id..".L"].text = string.format(
@@ -24,12 +24,22 @@ function update_setting(x, id, name, postfix)
)
end
+function update_checkbox_setting(id, value)
+ app.set_setting(id, value)
+
+ local recording_enabled = app.get_setting("audio.recording-enabled")
+ document.input_device_select.enabled = recording_enabled
+ document.input_volume_inner.enabled = recording_enabled
+ document.input_volume_outer.enabled = recording_enabled
+end
+
function create_checkbox(id, name, tooltip)
tooltip = tooltip or ''
document.root:add(string.format(
- "%s",
+ "%s",
id, app.str_setting(id), gui.str(tooltip, "settings"), gui.str(name, "settings")
))
+ update_checkbox_setting(id, app.get_setting(id))
end
local initialized = false
@@ -55,11 +65,12 @@ function on_open()
prev_amplitude = amplitude
end)
end
- create_setting("audio.volume-master", "Master Volume", 0.01)
- create_setting("audio.volume-regular", "Regular Sounds", 0.01)
- create_setting("audio.volume-ui", "UI Sounds", 0.01)
- create_setting("audio.volume-ambient", "Ambient", 0.01)
- create_setting("audio.volume-music", "Music", 0.01)
+ create_trackbar_setting("audio.volume-master", "Master Volume", 0.01)
+ create_trackbar_setting("audio.volume-regular", "Regular Sounds", 0.01)
+ create_trackbar_setting("audio.volume-ui", "UI Sounds", 0.01)
+ create_trackbar_setting("audio.volume-ambient", "Ambient", 0.01)
+ create_trackbar_setting("audio.volume-music", "Music", 0.01)
+
document.root:add("")
document.root:add("")
@@ -67,9 +78,7 @@ function on_open()
..""
.."")
local selectbox = document.input_device_select
- local devices = {
- {value="none", text=gui.str("None", "settings.microphone")},
- }
+ local devices = {}
local names = audio.__get_input_devices_names()
for i, name in ipairs(names) do
table.insert(devices, {value=name, text=name})
@@ -78,7 +87,10 @@ function on_open()
local info = audio.input.get_input_info()
if info then
selectbox.value = info.device_specifier
+ else
+ selectbox.value = app.get_setting("audio.input-device")
end
+ create_checkbox("audio.recording-enabled", "Microphone access", "audio.recording-enabled.tooltip")
create_checkbox("audio.acoustic-effects", "Acoustic effects", "audio.acoustic-effects.tooltip")
end
diff --git a/res/layouts/pages/settings_controls.xml b/res/layouts/pages/settings_controls.xml
index c5655e1d8..acd45c209 100644
--- a/res/layouts/pages/settings_controls.xml
+++ b/res/layouts/pages/settings_controls.xml
@@ -8,7 +8,7 @@
@settings.Controls Search Mode
-
+
diff --git a/res/layouts/pages/settings_display.xml.lua b/res/layouts/pages/settings_display.xml.lua
index 1e7861ff0..a3941bf2a 100644
--- a/res/layouts/pages/settings_display.xml.lua
+++ b/res/layouts/pages/settings_display.xml.lua
@@ -9,7 +9,7 @@ tostring_overrides["display.framerate"] = function(x)
end
end
-function create_setting(id, name, step, postfix, tooltip, changeonrelease)
+function create_trackbar_setting(id, name, step, postfix, tooltip, changeonrelease)
local info = app.get_setting_info(id)
postfix = postfix or ""
tooltip = tooltip or ""
@@ -25,10 +25,10 @@ function create_setting(id, name, step, postfix, tooltip, changeonrelease)
tooltip=tooltip,
changeonrelease=changeonrelease
}))
- update_setting(app.get_setting(id), id, name, postfix)
+ update_trackbar_label(app.get_setting(id), id, name, postfix)
end
-function update_setting(x, id, name, postfix)
+function update_trackbar_label(x, id, name, postfix)
local str
local func = tostring_overrides[id]
if func then
@@ -55,8 +55,8 @@ end
function on_open()
- create_setting("camera.fov", "FOV", 1, "°")
- create_setting("display.framerate", "Framerate", 1, "", "", true)
+ create_trackbar_setting("camera.fov", "FOV", 1, "°")
+ create_trackbar_setting("display.framerate", "Framerate", 1, "", "", true)
document.root:add(string.format(
"