* rename bars component to footer & + time and credits text to footer

This commit is contained in:
FajsiEx 2021-08-09 20:13:53 +02:00
parent 890fbacf9f
commit 60b2302a20
4 changed files with 81 additions and 170 deletions

View File

@ -1,168 +0,0 @@
local BAR_ALPHA = 191;
local TOP_BAR_HEIGHT = 110
local TOP_BAR_LINE_MARGIN = 20
local TOP_BAR_LINE_WIDTH = 48
local BOTTOM_BAR_HEIGTH = 128
local resx, resy = game.GetResolution();
local desw = 1080;
local desh = 1920;
local scale = 1;
local titleText = 'MODE SELECT'
local titleWidth = 250
-- Animation related
local entryTransitionScale = 0;
local entryTransitionTopBarOffset = 0;
local entryTransitionBottomBarOffset = 0;
local legend = {
{
control = 'START',
text = 'Confirm selection'
},
{
control = 'KNOB',
text = 'Scroll'
},
}
local set = function (title)
end
function resetLayoutInformation()
resx, resy = game.GetResolution()
desw = 1080
desh = 1920
scale = resx / desw
end
local drawLine = function(fx,fy,tx,ty,width,cr,cg,cb,ca)
gfx.Save()
gfx.BeginPath()
gfx.MoveTo(fx,fy)
gfx.LineTo(tx,ty)
gfx.StrokeWidth(width or 1)
gfx.StrokeColor(cr,cg,cb, ca or 255)
gfx.Stroke()
gfx.ClosePath()
gfx.Restore()
end
local drawTopBarLines = function ()
-- 'Glow' left lines
glowOffsetIterations = {
{-1.5,-1.5},
{-1.5,1.5},
{1.5,-1.5},
{1.5,1.5}
}
for key, offests in ipairs(glowOffsetIterations) do
drawLine(
resx/2-titleWidth/2-TOP_BAR_LINE_MARGIN+offests[1],
TOP_BAR_HEIGHT/2+offests[2],
resx/2-titleWidth/2-TOP_BAR_LINE_MARGIN-TOP_BAR_LINE_WIDTH+offests[1],
TOP_BAR_HEIGHT/2+offests[2],
4,
128,200,255,128
)
drawLine(
resx/2+titleWidth/2+TOP_BAR_LINE_MARGIN+offests[1],
TOP_BAR_HEIGHT/2+offests[2],
resx/2+titleWidth/2+TOP_BAR_LINE_MARGIN+TOP_BAR_LINE_WIDTH+offests[1],
TOP_BAR_HEIGHT/2+offests[2],
4,
128,200,255,128
)
end
-- Main left line
drawLine(
resx/2-titleWidth/2-TOP_BAR_LINE_MARGIN,
TOP_BAR_HEIGHT/2,
resx/2-titleWidth/2-TOP_BAR_LINE_MARGIN-TOP_BAR_LINE_WIDTH,
TOP_BAR_HEIGHT/2,
4,
255,255,255
)
-- Main right line
drawLine(
resx/2+titleWidth/2+TOP_BAR_LINE_MARGIN,
TOP_BAR_HEIGHT/2,
resx/2+titleWidth/2+TOP_BAR_LINE_MARGIN+TOP_BAR_LINE_WIDTH,
TOP_BAR_HEIGHT/2,
4,
255,255,255
)
end
local drawBottomBar = function ()
gfx.BeginPath();
gfx.FillColor(0,0,0,BAR_ALPHA);
gfx.Rect(0,resy-BOTTOM_BAR_HEIGTH+entryTransitionBottomBarOffset,resx, BOTTOM_BAR_HEIGTH);
gfx.Fill();
gfx.ClosePath();
end
local progressTransitions = function ()
entryTransitionScale = entryTransitionScale + 1/60 / 0.5;
if (entryTransitionScale > 1) then
entryTransitionScale = 1;
end
entryTransitionTopBarOffset = -TOP_BAR_HEIGHT*(1-entryTransitionScale)
entryTransitionBottomBarOffset = BOTTOM_BAR_HEIGTH*(1-entryTransitionScale)
end
local draw = function ()
gfx.Save()
resetLayoutInformation()
gfx.Scale(scale, scale)
-- Draw top background
gfx.BeginPath();
gfx.FillColor(0,0,0,BAR_ALPHA);
gfx.Rect(0,entryTransitionTopBarOffset,resx, TOP_BAR_HEIGHT);
gfx.Fill();
gfx.ClosePath();
-- -- Draw the 'glow' effect
-- gfx.LoadSkinFont("Digital-Serial-Bold.ttf");
-- gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE);
-- gfx.FontSize(47);
-- gfx.FillColor(128,200,255,190);
-- gfx.Text(titleText, resx/2+1, TOP_BAR_HEIGHT/2+1);
-- gfx.Text(titleText, resx/2+1, TOP_BAR_HEIGHT/2-1);
-- gfx.Text(titleText, resx/2-1, TOP_BAR_HEIGHT/2+1);
-- gfx.Text(titleText, resx/2-1, TOP_BAR_HEIGHT/2+1);
-- -- Draw top label
-- gfx.FillColor(255,255,255);
-- gfx.Text(titleText, resx/2, TOP_BAR_HEIGHT/2);
-- -- Draw the top label lines
-- drawTopBarLines()
gfx.LoadSkinFont("NotoSans-Regular.ttf");
drawBottomBar();
progressTransitions();
gfx.Restore()
end
return {
set = set,
draw = draw
};

View File

@ -0,0 +1,79 @@
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 ()
gfx.Save()
resetLayoutInformation()
gfx.Scale(scale, scale)
gfx.LoadSkinFont("NotoSans-Regular.ttf");
drawFooter();
progressTransitions();
gfx.Restore()
end
return {
set = set,
draw = draw
};

View File

@ -1,6 +1,6 @@
require('common') require('common')
local Easing = require('common.easings'); local Easing = require('common.easings');
local Bars = require('components.bars'); local Footer = require('components.footer');
local backgroundImage = gfx.CreateSkinImage("song_select/bg.png", 1) local backgroundImage = gfx.CreateSkinImage("song_select/bg.png", 1)
local dataPanelImage = gfx.CreateSkinImage("song_select/data_bg_overlay.png", 1) local dataPanelImage = gfx.CreateSkinImage("song_select/data_bg_overlay.png", 1)
@ -517,7 +517,7 @@ render = function (deltaTime)
drawSearch(); drawSearch();
Bars.draw(); Footer.draw();
gfx.BeginPath(); gfx.BeginPath();

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB