Add ambient light in graphics options
This commit is contained in:
parent
5fed08b17e
commit
ce6423320e
|
@ -95,3 +95,22 @@ Panel
|
||||||
minimum: 1
|
minimum: 1
|
||||||
maximum: 61
|
maximum: 61
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: ambientLightLabel
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
margin-top: 6
|
||||||
|
@onSetup: |
|
||||||
|
local value = Options.getOption('ambientLight')
|
||||||
|
self:setText(tr('Ambient light: %s%%', value))
|
||||||
|
|
||||||
|
FrameRateScrollbar
|
||||||
|
id: ambientLight
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
margin-top: 3
|
||||||
|
minimum: 0
|
||||||
|
maximum: 100
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ local defaultOptions = {
|
||||||
showLeftPanel = false,
|
showLeftPanel = false,
|
||||||
foregroundFrameRate = 61,
|
foregroundFrameRate = 61,
|
||||||
backgroundFrameRate = 201,
|
backgroundFrameRate = 201,
|
||||||
|
ambientLight = 15,
|
||||||
painterEngine = 0
|
painterEngine = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +178,17 @@ function Options.setOption(key, value)
|
||||||
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
|
graphicsPanel:getChildById('foregroundFrameRateLabel'):setText(tr('Interface framerate limit: %s', text))
|
||||||
end
|
end
|
||||||
g_app.setForegroundPaneMaxFps(value)
|
g_app.setForegroundPaneMaxFps(value)
|
||||||
|
elseif key == 'ambientLight' then
|
||||||
|
addEvent(function()
|
||||||
|
local map = rootWidget:recursiveGetChildById('gameMapPanel')
|
||||||
|
if graphicsPanel then
|
||||||
|
graphicsPanel:getChildById('ambientLightLabel'):setText(tr('Ambient light: %s%%', value))
|
||||||
|
end
|
||||||
|
if map then
|
||||||
|
map:setMinimumAmbientLight(value/100)
|
||||||
|
map:setDrawLights(value < 100)
|
||||||
|
end
|
||||||
|
end)
|
||||||
elseif key == 'painterEngine' then
|
elseif key == 'painterEngine' then
|
||||||
g_graphics.selectPainterEngine(value)
|
g_graphics.selectPainterEngine(value)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ OptionCheckBox < CheckBox
|
||||||
MainWindow
|
MainWindow
|
||||||
id: optionsWindow
|
id: optionsWindow
|
||||||
!text: tr('Options')
|
!text: tr('Options')
|
||||||
size: 350 290
|
size: 350 310
|
||||||
|
|
||||||
@onEnter: Options.hide()
|
@onEnter: Options.hide()
|
||||||
@onEscape: Options.hide()
|
@onEscape: Options.hide()
|
||||||
|
|
|
@ -658,6 +658,8 @@ void MapView::setDrawMinimapColors(bool enable)
|
||||||
|
|
||||||
void MapView::setDrawLights(bool enable)
|
void MapView::setDrawLights(bool enable)
|
||||||
{
|
{
|
||||||
|
if(enable == m_drawLights)
|
||||||
|
return;
|
||||||
if(enable)
|
if(enable)
|
||||||
m_lightView = LightViewPtr(new LightView);
|
m_lightView = LightViewPtr(new LightView);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue