* lower titlescreen selector bar by 128 px

This commit is contained in:
FajsiEx 2021-07-25 20:52:55 +02:00
parent 535ec4f369
commit fd2080941f
1 changed files with 17 additions and 13 deletions

View File

@ -4,6 +4,8 @@ local Bars = require('components/bars');
local cursorIndex = 3; local cursorIndex = 3;
local buttonHeight = 128 + 16; local buttonHeight = 128 + 16;
local SELECTOR_BAR_OFFSET_FROM_CENTER = 128;
local buttons = nil local buttons = nil
local resx, resy = game.GetResolution(); local resx, resy = game.GetResolution();
@ -106,30 +108,32 @@ draw_buttons = function()
getCorrectedButtonIndex(cursorIndex, 2), getCorrectedButtonIndex(cursorIndex, 2),
} }
centerButtonY = resy/2 - buttonHeight/2 - 28; -- to fit with the selector bg local yBase = resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER;
centerButtonY = yBase - buttonHeight/2 - 28; -- to fit with the selector bg
marginFromResYCenter = 128; marginFromResYCenter = 128;
if scrollingUp then if scrollingUp then
draw_button(buttons[indexes[5]], resx - 512, resy/2 - marginFromResYCenter - buttonHeight*3, false, 0); -- Placeholder for fadeout transition draw_button(buttons[indexes[5]], resx - 512, yBase - marginFromResYCenter - buttonHeight*3, false, 0); -- Placeholder for fadeout transition
end end
draw_button(buttons[indexes[1]], resx - 512, resy/2 - marginFromResYCenter - buttonHeight*2, false, 1); draw_button(buttons[indexes[1]], resx - 512, yBase - marginFromResYCenter - buttonHeight*2, false, 1);
draw_button(buttons[indexes[2]], resx - 512, resy/2 - marginFromResYCenter- buttonHeight, false, 2); draw_button(buttons[indexes[2]], resx - 512, yBase - marginFromResYCenter- buttonHeight, false, 2);
draw_button(buttons[indexes[3]], resx - 512, centerButtonY, true); -- The main selected center button draw_button(buttons[indexes[3]], resx - 512, centerButtonY, true); -- The main selected center button
if scrollingUp then if scrollingUp then
draw_button(buttons[indexes[3]], resx - 512, resy/2 + marginFromResYCenter - buttonHeight, false, 3); -- Placeholder for transition that goes to the bottom draw_button(buttons[indexes[3]], resx - 512, yBase + marginFromResYCenter - buttonHeight, false, 3); -- Placeholder for transition that goes to the bottom
else else
draw_button(buttons[indexes[3]], resx - 512, centerButtonY, false, 3); -- Placeholder for transition that goes to the top draw_button(buttons[indexes[3]], resx - 512, centerButtonY, false, 3); -- Placeholder for transition that goes to the top
end end
draw_button(buttons[indexes[4]], resx - 512, resy/2 + marginFromResYCenter, false, 4); draw_button(buttons[indexes[4]], resx - 512, yBase + marginFromResYCenter, false, 4);
draw_button(buttons[indexes[5]], resx - 512, resy/2 + marginFromResYCenter + buttonHeight, false, 5); draw_button(buttons[indexes[5]], resx - 512, yBase + marginFromResYCenter + buttonHeight, false, 5);
if not scrollingUp then if not scrollingUp then
draw_button(buttons[indexes[1]], resx - 512, resy/2 + marginFromResYCenter + buttonHeight*2, false, 6); draw_button(buttons[indexes[1]], resx - 512, yBase + marginFromResYCenter + buttonHeight*2, false, 6);
end end
end; end;
@ -162,13 +166,13 @@ function drawTexts()
-- Description -- Description
gfx.FillColor(255,255,255,math.floor(scrollTransitionScale*255)); gfx.FillColor(255,255,255,math.floor(scrollTransitionScale*255));
gfx.DrawLabel(selectorDescriptionLabel, 64, resy/2 - 52); gfx.DrawLabel(selectorDescriptionLabel, 64, resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 52);
-- Legend on the selector -- Legend on the selector
gfx.FillColor(217,177,126); gfx.FillColor(217,177,126);
gfx.DrawLabel(selectorLegendScrollLabel, 118, resy/2 + 56); gfx.DrawLabel(selectorLegendScrollLabel, 118, resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
gfx.DrawLabel(selectorLegendSelectLabel, 360, resy/2 + 56); gfx.DrawLabel(selectorLegendSelectLabel, 360, resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
gfx.FillColor(255,255,255); gfx.FillColor(255,255,255);
end; end;
@ -256,7 +260,7 @@ render = function(deltaTime)
end end
-- Draw selector background -- Draw selector background
gfx.ImageRect(0, (resy/2) - 280/2, 1079, 280, selectorBgImage, 1, 0); gfx.ImageRect(0, (resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER) - 280/2, 1079, 280, selectorBgImage, 1, 0);
setButtons() setButtons()
resx,resy = game.GetResolution(); resx,resy = game.GetResolution();
@ -267,7 +271,7 @@ render = function(deltaTime)
drawTexts(); drawTexts();
-- Draw the arrows around the selected button -- Draw the arrows around the selected button
gfx.ImageRect(resx-512, resy/2 - buttonHeight, 501, 277, selectorArrowsImage, 1, 0); gfx.ImageRect(resx-512, resy/2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight, 501, 277, selectorArrowsImage, 1, 0);
-- Draw top and bottom bars -- Draw top and bottom bars
--Bars.draw(); --Bars.draw();