ExperimentalGear/scripts/components/footer.lua

83 lines
1.6 KiB
Lua
Raw Normal View History

local resx, resy = game.GetResolution();
local desw = 1080;
local desh = 1920;
local scale = 1;
local BAR_ALPHA = 191;
local FOOTER_HEIGHT = 128
local footerY = desh;
-- 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 set = function ()
end
function resetLayoutInformation()
resx, resy = game.GetResolution()
desw = 1080
desh = 1920
scale = resx / desw
end
local drawFooter = function ()
gfx.BeginPath();
gfx.FillColor(0,0,0,BAR_ALPHA);
gfx.Rect(0,footerY,resx, FOOTER_HEIGHT);
gfx.Fill();
gfx.BeginPath();
gfx.ImageRect(desw-275, footerY-25, 328*0.85, 188*0.85, footerRightImage, 1, 0);
end
local progressTransitions = function ()
entryTransitionScale = entryTransitionScale + 1/60 / 0.5;
if (entryTransitionScale > 1) then
entryTransitionScale = 1;
end
entryTransitionFooterYOffset = FOOTER_HEIGHT*(1-entryTransitionScale)
footerY = resy-FOOTER_HEIGHT+entryTransitionFooterYOffset;
end
local draw = function (params)
if (params and params.noEnterTransition) then
entryTransitionScale = 1;
end
gfx.Save()
resetLayoutInformation()
gfx.Scale(scale, scale)
gfx.LoadSkinFont("NotoSans-Regular.ttf");
drawFooter();
progressTransitions();
gfx.Restore()
end
return {
set = set,
draw = draw
};