Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:Settings.SetBrightnessAndGamma

From RoR Wiki
Revision as of 19:49, 16 October 2026 by Maintenance script (talk | contribs) (UI Lua API import (WAR 1.4.8))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

UI Lua API · Interface functions
Version: WAR 1.4.8

Sets the brightness and gamma of the display.

Settings.SetBrightnessAndGamma(brightness, gamma)

Arguments

brightness
number – Brightness boost, from 0 to 0.5.
gamma
number – Gamma value, from 1 to 4.

Returns

Nothing.

Details

  • brightness is clamped to the range 0–0.5. A gamma below 1 or above 4 is replaced by 2.2.
  • The client builds a gamma ramp from the two values (the same curve for red, green and blue) and hands it to the graphics device. If the renderer or its device does not exist yet, nothing happens.
  • The function lives in the Settings table, so it is called as Settings.SetBrightnessAndGamma.
  • The stock video settings tab calls it every time one of its two sliders moves, so the change can be seen at once. It passes the brightness slider position divided by 4 and the gamma slider position times 3 plus 1.
  • The function needs at least two arguments and only reads the last two.

Errors

None besides the Invalid Parameters message when an argument is not a number.

Example

From ea_settingswindow/source/settingswindowtabvideo.lua:

function SettingsWindowTabVideo.OnGammaChanged( ignored )
    local brightness_boost = SliderBarGetCurrentPosition(SettingsWindowTabVideo.contentsName.."SettingsColorBrightnessSlider" ) / 4.0
    local monitor_gamma = (SliderBarGetCurrentPosition(SettingsWindowTabVideo.contentsName.."SettingsColorGammaSlider" ) * 3.0) + 1.0
    Settings.SetBrightnessAndGamma( brightness_boost, monitor_gamma )
end

See also