feat: add overlay darkening

This commit is contained in:
Kazhnuz 2021-08-31 19:13:17 +02:00
parent e0ebc4969c
commit 4ccb055672
2 changed files with 13 additions and 8 deletions

View file

@ -21,15 +21,15 @@ local animateDisappear = {
{"upBorder", "movement", 0.0, 0.5, 0, 0, "inOutQuart"},
{"downBorder", "movement", 0.0, 0.5, 424, 240, "inOutQuart"},
{"version", "movement", 0.0, 0.5, 380, 250, "inOutQuart"},
{"overlayDarken", "tween", 0.0, 0.4, {opacity = 0}, "outExpo"}
{"overlayDarken", "tween", 0.0, 0.6, {opacity = 0}, "outExpo"}
}
local showBackground = {
{"overlayDarken", "tween", 0.0, 0.4, {opacity = OVERLAY_OPACITY}, "inExpo"}
{"overlayDarken", "tween", 0.0, 0.6, {opacity = OVERLAY_OPACITY}, "inExpo"}
}
local hideBackground = {
{"overlayDarken", "tween", 0.0, 0.4, {opacity = 0}, "outExpo"}
{"overlayDarken", "tween", 0.0, 0.6, {opacity = 0}, "outExpo"}
}
local showVersion = {
@ -86,10 +86,10 @@ function OverlayScreen:createElements()
local d = either(wasActive, 30, 0)
local v = either(hadVersion, 30, 0)
return {
{TextureElement("upBorder", self.borders, 0, d, 0, 1, -1, 0, 0, 1, -1), 0},
{TextureElement("downBorder", self.borders, 424, 240 - d, 0, -1, 1, 0, 0, 1, -1), 0},
{ColorElement("overlayDarken", 0, 0, 0, 0), 0},
{TextElement("version", "small", "v" .. game.version, 380, 250 - v, "left", -1), 0}
{TextureElement("upBorder", self.borders, 0, d, 0, 1, -1, 0, 0, 1), 0, -1},
{TextureElement("downBorder", self.borders, 424, 240 - d, 0, -1, 1, 0, 0, 1), 0, -1},
{ColorElement("overlayDarken", 0, 0, 0, 0), 0, 5},
{TextElement("version", "small", "v" .. game.version, 380, 250 - v, "left"), 0, -1}
}
end

View file

@ -2,6 +2,7 @@ local BirbScene = require "birb.modules.scenes"
local RadianceScene = BirbScene:extend()
local Overlay = require "game.modules.gui.overlay"
local MessageQueue = require "game.modules.messagequeue"
function RadianceScene:new(haveBorder, showVersion)
RadianceScene.super.new(self)
@ -16,14 +17,18 @@ function RadianceScene:new(haveBorder, showVersion)
self.gui:addSFX("error", "mError")
Overlay(haveBorder, showVersion)
MessageQueue(self)
end
function RadianceScene:hideOverlay()
self.gui:hideScreen("overlay")
end
function RadianceScene:showOverlay()
function RadianceScene:showOverlay(darken)
self.gui:showScreen("overlay")
if (darken) then
self.gui:playScreenTransform("overlay", "showBackground")
end
end