API:Settings.SetBrightnessAndGamma
From RoR Wiki
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
brightnessis clamped to the range 0–0.5. Agammabelow 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
Settingstable, so it is called asSettings.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
