ExperimentalGear/scripts/graphics/footer.lua

68 lines
1.8 KiB
Lua
Raw Normal View History

local version = require("common.version")
2024-02-02 02:50:48 +01:00
local Display = require("scripts.graphics.display")
local BAR_ALPHA = 191
local FOOTER_HEIGHT = 128
2024-02-02 02:50:48 +01:00
local footerY = Display.design.height - FOOTER_HEIGHT
-- Images
local footerRightImage = gfx.CreateSkinImage("components/bars/footer_right.png", 0)
-- Animation related
local entryTransitionScale = 0
local entryTransitionFooterYOffset = 0
local legend = {{control = "START", text = "Confirm selection"}, {control = "KNOB", text = "Scroll"}}
local function set() end
local function drawFooter()
gfx.BeginPath()
gfx.FillColor(0, 0, 0, BAR_ALPHA)
2024-02-02 02:50:48 +01:00
gfx.Rect(0, footerY, Display.design.width, FOOTER_HEIGHT)
gfx.Fill()
gfx.BeginPath()
2024-02-02 02:50:48 +01:00
gfx.ImageRect(Display.design.width - 275, footerY - 25, 328 * 0.85, 188 * 0.85, footerRightImage, 1, 0)
gfx.BeginPath()
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
2021-08-13 22:59:35 +02:00
gfx.FontSize(20)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FillColor(255, 255, 255, 255)
gfx.Text("EXPERIMENTALGEAR " .. version.major .. "." .. version.minor .. "." .. version.patch .. "", 8, 1895)
end
local function progressTransitions(deltaTime)
entryTransitionScale = entryTransitionScale + deltaTime / 0.3
if (entryTransitionScale > 1) then entryTransitionScale = 1 end
entryTransitionFooterYOffset = FOOTER_HEIGHT * (1 - entryTransitionScale)
2024-02-02 02:50:48 +01:00
footerY = Display.design.height - FOOTER_HEIGHT + entryTransitionFooterYOffset
end
local function draw(deltaTime, params)
if params and params.noEnterTransition then
entryTransitionScale = 1
end
gfx.Save()
gfx.ResetTransform()
2024-02-02 02:50:48 +01:00
Display.updateResolution()
2024-02-02 02:50:48 +01:00
Display.transformToScreenSpace()
gfx.LoadSkinFont("NotoSans-Regular.ttf")
drawFooter()
progressTransitions(deltaTime)
gfx.Restore()
end
return {set = set, draw = draw}