scenes/mainmenu: dim the main menu when inactive

This commit is contained in:
Kazhnuz 2019-03-09 22:07:26 +01:00
parent 1b514f8346
commit f49773823f
1 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,8 @@ local MapWidget = MainWidget:extend()
local ExitWidget = MainWidget:extend()
local OptionsWidget = MainWidget:extend()
local DIMVALUE = .5
function MenuObject:new(scene)
self.scene = scene
local screenwidth, screenheight = core.screen:getDimensions()
@ -59,6 +61,20 @@ function MainWidget:drawCanvas()
end
end
function MainWidget:draw(x, y)
if self.menu.isActive == false then
love.graphics.setColor(DIMVALUE, DIMVALUE, DIMVALUE, 1)
else
utils.graphics.resetColor()
end
if self.canvas.texture ~= nil then
love.graphics.draw(self.canvas.texture, x, y)
end
utils.graphics.resetColor()
end
function MapWidget:new(menusystem)
MapWidget.super.new(self, menusystem, "WORLD MAP")
end