Skip to content

graphics_presets_util

Source: base/tealdef/gui/menu/graphics_presets_util.d.tl

Notes

Graphics quality presets (desktop and console) and helpers to detect or apply a preset on an AppConfig.

GraphicsPresetsUtil

record global base/tealdef/gui/menu/graphics_presets_util.d.tl:3

global record GraphicsPresetsUtil

Load: local graphics_presets_util = ug_require "/gui/menu/graphics_presets_util.tl"

Notes

Util table of graphics_presets_util.tl.

Functions

getGraphicPreset(presets : {{string : {any, any}}}, config : AppConfig) : integer base/tealdef/gui/menu/graphics_presets_util.d.tl:4

Call as graphics_presets_util.getGraphicPreset

Notes

Returns the index of the first preset whose values all match the given config.

Parameter Type Description
presets {{string : {any, any}}} Preset list, e.g. from getDesktopPresets() or getConsolePresets().
config AppConfig Configuration to compare, usually api.util.getAppConfig().

Returns integer: Index of the matching preset, or #presets + 1 ("custom") when none matches. Numbers are compared with a tolerance of 0.001.

Used in the base game: 4 times in 1 file

base/content/gui/gui/menu/settings_page.tl:775

local graphicPreset = graphics_presets_util.getGraphicPreset(desktopPresetSettings, appConfig)

setGraphicPreset(presets : {{string : {any, any}}}, config : AppConfig, option : integer, inGame : boolean) base/tealdef/gui/menu/graphics_presets_util.d.tl:5

Call as graphics_presets_util.setGraphicPreset

Notes

Writes the values of one preset into an AppConfig object.

Parameter Type Description
presets {{string : {any, any}}} Preset list, e.g. from getDesktopPresets() or getConsolePresets().
config AppConfig Config object to change, e.g. api.type.AppConfig.new(api.util.getAppConfig()); it still has to be applied with api.util.setAppConfig.
option integer Index of the preset. #presets + 1 (custom) does nothing.
inGame boolean When true, entries whose second element is true are skipped.
Used in the base game: 2 times in 1 file

base/content/gui/gui/menu/settings_page.tl:894

graphics_presets_util.setGraphicPreset(desktopPresetSettings, config, graphicsPresets, inGame)

getDesktopPresets() : {{string : {any, any}}} base/tealdef/gui/menu/graphics_presets_util.d.tl:7

Call as graphics_presets_util.getDesktopPresets

Notes

Returns the four desktop presets, in order low, medium, high, very high.

Returns {{string : {any, any}}}: Preset list covering textureQuality, terrainTextureQuality, numMSAASamples, useSsao, ssrQuality, shadowQuality, geometryQuality, terrainQuality and grassQuality.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/settings_page.tl:774

local desktopPresetSettings = graphics_presets_util.getDesktopPresets()

getConsolePresets() : {{string : {any, any}}} base/tealdef/gui/menu/graphics_presets_util.d.tl:8

Call as graphics_presets_util.getConsolePresets

Notes

Returns the two console presets, quality (30 Hz) and performance (60 Hz), merged with the base settings of the console generation reported by api.util.getPlaformDeviceSpec().

Returns {{string : {any, any}}}: Preset list; besides the quality settings it also sets refreshRate, resolutionScale, terrainTesselationQuality and useReflection.

Used in the base game: 1 time in 1 file

base/content/gui/gui/menu/settings_page.tl:1004

local consolePresetsSettings = graphics_presets_util.getConsolePresets()