155 lines
3.6 KiB
Lua
155 lines
3.6 KiB
Lua
|
|
|
|
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 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
|
|
|
|
|
|
|
|
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 ()
|
|
resx, resy = game.GetResolution();
|
|
|
|
-- 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/digital.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();
|
|
end
|
|
|
|
return {
|
|
set = set,
|
|
draw = draw
|
|
}; |