ExperimentalGear/scripts/titlescreen/pages/splash/teamexceedpage.lua

102 lines
2.6 KiB
Lua
Raw Normal View History

require "common.globals"
require "common.class"
local Dim = require "common.dimensions"
local Image = require "api.image"
local Page = require "api.page.page"
local splash3BgColor = {255, 255, 255}
local splash3Logo = gfx.CreateSkinImage("titlescreen/splash/team-exceed.png", 0)
local splash3LogoWidth, splash3LogoHeight = gfx.ImageSize(splash3Logo)
local function splash3(deltaTime)
local splash3LogoXOffset = (Dim.design.width - splash3LogoWidth) / 2
local splash3LogoYOffset = (Dim.design.height - splash3LogoHeight) / 2
calcFade(splash3Duration)
gfx.BeginPath()
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.FillColor(splash3BgColor[1], splash3BgColor[2], splash3BgColor[3], fadeAlpha)
gfx.Fill()
gfx.BeginPath()
gfx.ImageRect(splash3LogoXOffset, splash3LogoYOffset, splash3LogoWidth, splash3LogoHeight, splash3Logo, fadeAlpha / 255, 0)
gfx.BeginPath()
gfx.LoadSkinFont("segoeui.ttf")
gfx.FillColor(0, 0, 0, fadeAlpha)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_BOTTOM)
gfx.FontSize(28)
gfx.Text("Press START to skip...", 10, Dim.design.height - 10)
if (splashTimer < 0) then
splashState = "done"
splashTimer = 0
return
end
if splashTimer == 0 then
splashTimer = splash3Duration
end
splashTimer = splashTimer - deltaTime
end
---@class TeamExceedPage : Page
---@field logo_img Image
---@field _timer number
local TeamExceedPage = {
__name = "TeamExceedPage",
BACKGROUND_COLOR = {255, 255, 255},
LOGO_PATH = "titlescreen/splash/team-exceed.png",
TIMEOUT = 3.0
}
---Create a new TeamExceedPage instance
---@param params? TeamExceedPage
function TeamExceedPage.new(params)
local self = CreateInstance(TeamExceedPage, params, Page)
self.logo_img = Image.new(self.LOGO_PATH)
self._timer = 0.0
return self
end
function TeamExceedPage:init()
self._timer = 0.0
Page.init(self)
end
function TeamExceedPage:drawBackground(deltaTime)
gfx.BeginPath()
gfx.FillColor(table.unpack(self.BACKGROUND_COLOR))
gfx.Rect(0, 0, Dim.design.width, Dim.design.height)
gfx.Fill()
end
function TeamExceedPage:drawContent(deltaTime)
local x = (Dim.design.width - self.logo_img.width) / 2
local y = (Dim.design.height - self.logo_img.height) / 2
self.logo_img:setPosition(x, y)
self.logo_img:render()
end
function TeamExceedPage:render(deltaTime)
Page.render(self, deltaTime)
if self._timer > self.TIMEOUT then
self:onInvalidation()
end
self._timer = self._timer + deltaTime
end
return TeamExceedPage