Add GUI scale setting and volume contrast setting

GUI scale (#737):
- add display.gui-scale setting (0 - auto, 1..4 - fixed integer scale)
- auto mode picks the largest scale keeping at least 640x480 UI units
- apply scale in GUI (root size, camera, cursor, tooltips, scissors)
- HUD layout and ModelViewer use scaled coordinates
- add GUI Scale trackbar to display settings

Volume contrast (#399):
- add audio.volume-contrast setting (100% - unchanged sounds,
  0% - loud sounds are lowered to the level of quiet ones)
- loudness (RMS) of a sound is calculated once and cached
- add trackbar to audio settings and reset page
This commit is contained in:
loki5512344 2026-10-03 12:56:54 +00:00
parent dacebf94bc
commit 708c276787
14 changed files with 158 additions and 17 deletions

View file

@ -9,6 +9,14 @@ tostring_overrides["display.framerate"] = function(x)
end
end
tostring_overrides["display.gui-scale"] = function(x)
if x == 0 then
return gui.str("Auto")
else
return tostring(x)
end
end
function create_trackbar_setting(id, name, step, postfix, tooltip, changeonrelease)
local info = app.get_setting_info(id)
postfix = postfix or ""
@ -57,6 +65,7 @@ end
function on_open()
create_trackbar_setting("camera.fov", "FOV", 1, "°")
create_trackbar_setting("display.framerate", "Framerate", 1, "", "", true)
create_trackbar_setting("display.gui-scale", "GUI Scale", 1, "", "display.gui-scale.tooltip", true)
document.root:add(string.format(
"<select context='settings' onselect='function(opt) app.set_setting(\"display.window-mode\", tonumber(opt)) end' selected='%s'>"..