+ footer and basic header without text to titlescreen
This commit is contained in:
parent
f1199e60ef
commit
e3561a8785
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
local Footer = require('components.footer');
|
local Footer = require('components.footer');
|
||||||
|
|
||||||
local cursorIndex = 3;
|
local cursorIndex = 3;
|
||||||
|
@ -6,6 +5,9 @@ local buttonHeight = 128 + 16;
|
||||||
|
|
||||||
local SELECTOR_BAR_OFFSET_FROM_CENTER = 128;
|
local SELECTOR_BAR_OFFSET_FROM_CENTER = 128;
|
||||||
|
|
||||||
|
local BAR_ALPHA = 191;
|
||||||
|
local HEADER_HEIGHT = 100
|
||||||
|
|
||||||
local buttons = nil
|
local buttons = nil
|
||||||
local resx, resy = game.GetResolution()
|
local resx, resy = game.GetResolution()
|
||||||
local desw = 1080
|
local desw = 1080
|
||||||
|
@ -14,29 +16,36 @@ local scale;
|
||||||
|
|
||||||
local bgImage = gfx.CreateSkinImage('titlescreen/bg.png', 0);
|
local bgImage = gfx.CreateSkinImage('titlescreen/bg.png', 0);
|
||||||
local selectorBgImage = gfx.CreateSkinImage('titlescreen/selector_bg.png', 0);
|
local selectorBgImage = gfx.CreateSkinImage('titlescreen/selector_bg.png', 0);
|
||||||
local selectorArrowsImage = gfx.CreateSkinImage('titlescreen/selector_arrows.png', 0);
|
local selectorArrowsImage = gfx.CreateSkinImage(
|
||||||
|
'titlescreen/selector_arrows.png', 0);
|
||||||
|
|
||||||
local unselectedButtonImage = gfx.CreateSkinImage('titlescreen/unselected_button.png', 0);
|
local unselectedButtonImage = gfx.CreateSkinImage(
|
||||||
|
'titlescreen/unselected_button.png', 0);
|
||||||
|
|
||||||
local selectedButtonBgImage = gfx.CreateSkinImage('titlescreen/selected_button_bg.png', 0);
|
local selectedButtonBgImage = gfx.CreateSkinImage(
|
||||||
local selectedButtonOverImage = gfx.CreateSkinImage('titlescreen/selected_button_over.png', 0);
|
'titlescreen/selected_button_bg.png', 0);
|
||||||
|
local selectedButtonOverImage = gfx.CreateSkinImage(
|
||||||
|
'titlescreen/selected_button_over.png', 0);
|
||||||
|
|
||||||
local skillLabelImage = gfx.CreateSkinImage('titlescreen/labels/skill.png', 0);
|
local skillLabelImage = gfx.CreateSkinImage('titlescreen/labels/skill.png', 0);
|
||||||
local friendLabelImage = gfx.CreateSkinImage('titlescreen/labels/friend.png', 0);
|
local friendLabelImage = gfx.CreateSkinImage('titlescreen/labels/friend.png', 0);
|
||||||
local normalLabelImage = gfx.CreateSkinImage('titlescreen/labels/normal.png', 0);
|
local normalLabelImage = gfx.CreateSkinImage('titlescreen/labels/normal.png', 0);
|
||||||
local nauticaLabelImage = gfx.CreateSkinImage('titlescreen/labels/nautica.png', 0);
|
local nauticaLabelImage = gfx.CreateSkinImage('titlescreen/labels/nautica.png',
|
||||||
local settingsLabelImage = gfx.CreateSkinImage('titlescreen/labels/settings.png', 0);
|
0);
|
||||||
|
local settingsLabelImage = gfx.CreateSkinImage(
|
||||||
|
'titlescreen/labels/settings.png', 0);
|
||||||
local exitLabelImage = gfx.CreateSkinImage('titlescreen/labels/exit.png', 0);
|
local exitLabelImage = gfx.CreateSkinImage('titlescreen/labels/exit.png', 0);
|
||||||
|
|
||||||
-- ANIMS
|
-- ANIMS
|
||||||
local idolAnimation = gfx.LoadSkinAnimation('idol', 1/30, 0, true);
|
local idolAnimation = gfx.LoadSkinAnimation('idol', 1 / 30, 0, true);
|
||||||
|
|
||||||
-- AUDIO
|
-- AUDIO
|
||||||
game.LoadSkinSample('titlescreen/bgm.wav');
|
game.LoadSkinSample('titlescreen/bgm.wav');
|
||||||
game.LoadSkinSample('titlescreen/cursor_change.wav');
|
game.LoadSkinSample('titlescreen/cursor_change.wav');
|
||||||
game.LoadSkinSample('titlescreen/cursor_select.wav');
|
game.LoadSkinSample('titlescreen/cursor_select.wav');
|
||||||
|
|
||||||
local selectorDescriptionLabel = gfx.CreateLabel('Test description. Blah blah blah', 22, 0);
|
local selectorDescriptionLabel = gfx.CreateLabel(
|
||||||
|
'Test description. Blah blah blah', 22, 0);
|
||||||
|
|
||||||
local selectorLegendScrollLabel = gfx.CreateLabel('Scroll', 20, 0);
|
local selectorLegendScrollLabel = gfx.CreateLabel('Scroll', 20, 0);
|
||||||
local selectorLegendSelectLabel = gfx.CreateLabel('START', 20, 0);
|
local selectorLegendSelectLabel = gfx.CreateLabel('START', 20, 0);
|
||||||
|
@ -58,279 +67,328 @@ function resetLayoutInformation()
|
||||||
end
|
end
|
||||||
|
|
||||||
draw_button = function(button, x, y, selected, index)
|
draw_button = function(button, x, y, selected, index)
|
||||||
local labelImage = button[1];
|
local labelImage = button[1];
|
||||||
local labelWidth = button[2];
|
local labelWidth = button[2];
|
||||||
local descriptionText = button[4];
|
local descriptionText = button[4];
|
||||||
|
|
||||||
if (selected) then
|
if (selected) then
|
||||||
-- Draw button background
|
-- Draw button background
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(x, y+(196/2 * (1-scrollTransitionScale)), 505, 196*scrollTransitionScale, selectedButtonBgImage, 1, 0);
|
gfx.ImageRect(x, y + (196 / 2 * (1 - scrollTransitionScale)), 505,
|
||||||
-- Draw button main label
|
196 * scrollTransitionScale, selectedButtonBgImage, 1, 0);
|
||||||
gfx.BeginPath();
|
-- Draw button main label
|
||||||
gfx.ImageRect(x + 256 - (labelWidth/2), (y+58)+(64/2 * (1-scrollTransitionScale)), labelWidth, 64*scrollTransitionScale, labelImage, 1, 0);
|
gfx.BeginPath();
|
||||||
|
gfx.ImageRect(x + 256 - (labelWidth / 2),
|
||||||
|
(y + 58) + (64 / 2 * (1 - scrollTransitionScale)),
|
||||||
|
labelWidth, 64 * scrollTransitionScale, labelImage, 1, 0);
|
||||||
|
|
||||||
-- Draw description
|
-- Draw description
|
||||||
|
|
||||||
gfx.GlobalAlpha((scrollTransitionScale - 0.8) * 5)
|
gfx.GlobalAlpha((scrollTransitionScale - 0.8) * 5)
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.FontSize(40);
|
gfx.FontSize(40);
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.Text(descriptionText, x+256, y+28);
|
gfx.Text(descriptionText, x + 256, y + 28);
|
||||||
gfx.GlobalAlpha(1)
|
gfx.GlobalAlpha(1)
|
||||||
|
|
||||||
-- Draw the glow overlay
|
-- Draw the glow overlay
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(x+2, (y-42)+(277/2 * (1-scrollTransitionScale)), 501, 277*scrollTransitionScale, selectedButtonOverImage, 1, 0);
|
gfx.ImageRect(x + 2, (y - 42) + (277 / 2 * (1 - scrollTransitionScale)),
|
||||||
else
|
501, 277 * scrollTransitionScale, selectedButtonOverImage,
|
||||||
if scrollingUp then
|
1, 0);
|
||||||
if (index == 3 or index == 0) then
|
else
|
||||||
gfx.GlobalAlpha(1-scrollTransitionScale);
|
if scrollingUp then
|
||||||
end
|
if (index == 3 or index == 0) then
|
||||||
if (index == 2 or index == 5) then
|
gfx.GlobalAlpha(1 - scrollTransitionScale);
|
||||||
gfx.GlobalAlpha(scrollTransitionScale);
|
end
|
||||||
end
|
if (index == 2 or index == 5) then
|
||||||
else
|
gfx.GlobalAlpha(scrollTransitionScale);
|
||||||
if (index == 3 or index == 6) then
|
end
|
||||||
gfx.GlobalAlpha(1-scrollTransitionScale);
|
else
|
||||||
end
|
if (index == 3 or index == 6) then
|
||||||
if (index == 1 or index == 4) then
|
gfx.GlobalAlpha(1 - scrollTransitionScale);
|
||||||
gfx.GlobalAlpha(scrollTransitionScale);
|
end
|
||||||
end
|
if (index == 1 or index == 4) then
|
||||||
end
|
gfx.GlobalAlpha(scrollTransitionScale);
|
||||||
-- Draw button background
|
end
|
||||||
gfx.BeginPath();
|
end
|
||||||
gfx.ImageRect(x, y + buttonsMovementScale*buttonHeight, 1026 / 2, 257 / 2, unselectedButtonImage, 1, 0);
|
-- Draw button background
|
||||||
|
gfx.BeginPath();
|
||||||
|
gfx.ImageRect(x, y + buttonsMovementScale * buttonHeight, 1026 / 2,
|
||||||
|
257 / 2, unselectedButtonImage, 1, 0);
|
||||||
|
|
||||||
-- Draw button main label
|
-- Draw button main label
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(x+64, y+28 + buttonsMovementScale*buttonHeight, labelWidth, 64, labelImage, 1, 0);
|
gfx.ImageRect(x + 64, y + 28 + buttonsMovementScale * buttonHeight,
|
||||||
-- Draw description
|
labelWidth, 64, labelImage, 1, 0);
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
-- Draw description
|
||||||
gfx.FontSize(28);
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||||
gfx.BeginPath();
|
gfx.FontSize(28);
|
||||||
gfx.Text(descriptionText, x+64, y+18 + buttonsMovementScale*buttonHeight);
|
gfx.BeginPath();
|
||||||
|
gfx.Text(descriptionText, x + 64,
|
||||||
|
y + 18 + buttonsMovementScale * buttonHeight);
|
||||||
|
|
||||||
gfx.GlobalAlpha(1)
|
gfx.GlobalAlpha(1)
|
||||||
end;
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
draw_buttons = function()
|
draw_buttons = function()
|
||||||
indexes = {
|
indexes = {
|
||||||
getCorrectedButtonIndex(cursorIndex, -2),
|
getCorrectedButtonIndex(cursorIndex, -2),
|
||||||
getCorrectedButtonIndex(cursorIndex, -1),
|
getCorrectedButtonIndex(cursorIndex, -1), cursorIndex,
|
||||||
cursorIndex,
|
getCorrectedButtonIndex(cursorIndex, 1),
|
||||||
getCorrectedButtonIndex(cursorIndex, 1),
|
getCorrectedButtonIndex(cursorIndex, 2)
|
||||||
getCorrectedButtonIndex(cursorIndex, 2),
|
}
|
||||||
}
|
|
||||||
|
|
||||||
local yBase = desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER;
|
local yBase = desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER;
|
||||||
|
|
||||||
centerButtonY = yBase - buttonHeight/2 - 28; -- to fit with the selector bg
|
centerButtonY = yBase - buttonHeight / 2 - 28; -- to fit with the selector bg
|
||||||
marginFromDesHCenter = 128;
|
marginFromDesHCenter = 128;
|
||||||
|
|
||||||
if scrollingUp then
|
if scrollingUp then
|
||||||
draw_button(buttons[indexes[5]], desw - 512, yBase - marginFromDesHCenter - buttonHeight*3, false, 0); -- Placeholder for fadeout transition
|
draw_button(buttons[indexes[5]], desw - 512,
|
||||||
end
|
yBase - marginFromDesHCenter - buttonHeight * 3, false, 0); -- Placeholder for fadeout transition
|
||||||
|
end
|
||||||
|
|
||||||
draw_button(buttons[indexes[1]], desw - 512, yBase - marginFromDesHCenter - buttonHeight*2, false, 1);
|
draw_button(buttons[indexes[1]], desw - 512,
|
||||||
draw_button(buttons[indexes[2]], desw - 512, yBase - marginFromDesHCenter- buttonHeight, false, 2);
|
yBase - marginFromDesHCenter - buttonHeight * 2, false, 1);
|
||||||
|
draw_button(buttons[indexes[2]], desw - 512,
|
||||||
|
yBase - marginFromDesHCenter - buttonHeight, false, 2);
|
||||||
|
|
||||||
|
draw_button(buttons[indexes[3]], desw - 512, centerButtonY, true); -- The main selected center button
|
||||||
|
|
||||||
draw_button(buttons[indexes[3]], desw - 512, centerButtonY, true); -- The main selected center button
|
if scrollingUp then
|
||||||
|
draw_button(buttons[indexes[3]], desw - 512,
|
||||||
|
yBase + marginFromDesHCenter - buttonHeight, false, 3); -- Placeholder for transition that goes to the bottom
|
||||||
|
else
|
||||||
|
draw_button(buttons[indexes[3]], desw - 512, centerButtonY, false, 3); -- Placeholder for transition that goes to the top
|
||||||
|
end
|
||||||
|
|
||||||
if scrollingUp then
|
draw_button(buttons[indexes[4]], desw - 512,
|
||||||
draw_button(buttons[indexes[3]], desw - 512, yBase + marginFromDesHCenter - buttonHeight, false, 3); -- Placeholder for transition that goes to the bottom
|
yBase + marginFromDesHCenter + 10, false, 4);
|
||||||
else
|
draw_button(buttons[indexes[5]], desw - 512,
|
||||||
draw_button(buttons[indexes[3]], desw - 512, centerButtonY, false, 3); -- Placeholder for transition that goes to the top
|
yBase + marginFromDesHCenter + buttonHeight + 10, false, 5);
|
||||||
end
|
|
||||||
|
|
||||||
draw_button(buttons[indexes[4]], desw - 512, yBase + marginFromDesHCenter + 10, false, 4);
|
if not scrollingUp then
|
||||||
draw_button(buttons[indexes[5]], desw - 512, yBase + marginFromDesHCenter + buttonHeight + 10, false, 5);
|
draw_button(buttons[indexes[1]], desw - 512,
|
||||||
|
yBase + marginFromDesHCenter + buttonHeight * 2, false, 6);
|
||||||
if not scrollingUp then
|
end
|
||||||
draw_button(buttons[indexes[1]], desw - 512, yBase + marginFromDesHCenter + buttonHeight*2, false, 6);
|
|
||||||
end
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function getCorrectedButtonIndex(from, offset)
|
function getCorrectedButtonIndex(from, offset)
|
||||||
buttonsNum = #buttons;
|
buttonsNum = #buttons;
|
||||||
|
|
||||||
index = from + offset;
|
index = from + offset;
|
||||||
|
|
||||||
if index < 1 then
|
if index < 1 then
|
||||||
index = buttonsNum + (from+offset) -- this only happens if the offset is negative
|
index = buttonsNum + (from + offset) -- this only happens if the offset is negative
|
||||||
end;
|
end
|
||||||
|
|
||||||
if index > buttonsNum then
|
if index > buttonsNum then
|
||||||
indexesUntilEnd = buttonsNum - from;
|
indexesUntilEnd = buttonsNum - from;
|
||||||
index = offset - indexesUntilEnd -- this only happens if the offset is positive
|
index = offset - indexesUntilEnd -- this only happens if the offset is positive
|
||||||
end;
|
end
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
end;
|
end
|
||||||
|
|
||||||
function drawTexts()
|
function drawTexts()
|
||||||
|
|
||||||
currentFullDescriptionText = buttons[cursorIndex][5];
|
currentFullDescriptionText = buttons[cursorIndex][5];
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.UpdateLabel(selectorDescriptionLabel, currentFullDescriptionText, 22)
|
gfx.UpdateLabel(selectorDescriptionLabel, currentFullDescriptionText, 22)
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.UpdateLabel(selectorLegendScrollLabel, 'DEBUG: ' .. buttonsMovementScale, 20);
|
gfx.UpdateLabel(selectorLegendScrollLabel,
|
||||||
|
'DEBUG: ' .. buttonsMovementScale, 20);
|
||||||
|
|
||||||
-- descriptionAlpha = math.abs(selectedButtonScaleY - 0.5) * 2;
|
-- descriptionAlpha = math.abs(selectedButtonScaleY - 0.5) * 2;
|
||||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE);
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE);
|
||||||
|
|
||||||
-- Description
|
-- Description
|
||||||
gfx.FillColor(255,255,255,math.floor(scrollTransitionScale*255));
|
gfx.FillColor(255, 255, 255, math.floor(scrollTransitionScale * 255));
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.DrawLabel(selectorDescriptionLabel, 64, desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 52);
|
gfx.DrawLabel(selectorDescriptionLabel, 64,
|
||||||
|
desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER - 52);
|
||||||
|
|
||||||
|
-- Legend on the selector
|
||||||
|
gfx.FillColor(217, 177, 126);
|
||||||
|
|
||||||
-- Legend on the selector
|
gfx.BeginPath();
|
||||||
gfx.FillColor(217,177,126);
|
gfx.DrawLabel(selectorLegendScrollLabel, 118,
|
||||||
|
desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.DrawLabel(selectorLegendScrollLabel, 118, desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
|
gfx.DrawLabel(selectorLegendSelectLabel, 360,
|
||||||
|
desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.FillColor(255, 255, 255);
|
||||||
gfx.DrawLabel(selectorLegendSelectLabel, 360, desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER + 56);
|
end
|
||||||
|
|
||||||
gfx.FillColor(255,255,255);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function setButtons()
|
function setButtons()
|
||||||
if buttons == nil then
|
if buttons == nil then
|
||||||
buttons = {}
|
buttons = {}
|
||||||
buttons[1] = {skillLabelImage, 412, Menu.Challenges, "Idk", "Torture yourself :)"}
|
buttons[1] = {
|
||||||
buttons[2] = {friendLabelImage, 169, Menu.Multiplayer, "Wait, there's multiplayer???", "Yes, but nobody is ever online"}
|
skillLabelImage, 412, Menu.Challenges, "Idk", "Torture yourself :)"
|
||||||
buttons[3] = {normalLabelImage, 210, Menu.Start, "Play shit idk", "Play something blah blah blah blah\nWith newlines"}
|
}
|
||||||
buttons[4] = {nauticaLabelImage, 230, Menu.DLScreen, "Download more songs", "ksm.dev"}
|
buttons[2] = {
|
||||||
buttons[5] = {settingsLabelImage, 247, Menu.Settings, "Adjust things", "Open settings"}
|
friendLabelImage, 169, Menu.Multiplayer,
|
||||||
buttons[6] = {exitLabelImage, 110, Menu.Exit, "Leave this cursed game", "C'mon press that button!\nYou know you want to do it"}
|
"Wait, there's multiplayer???", "Yes, but nobody is ever online"
|
||||||
end
|
}
|
||||||
|
buttons[3] = {
|
||||||
|
normalLabelImage, 210, Menu.Start, "Play shit idk",
|
||||||
|
"Play something blah blah blah blah\nWith newlines"
|
||||||
|
}
|
||||||
|
buttons[4] = {
|
||||||
|
nauticaLabelImage, 230, Menu.DLScreen, "Download more songs",
|
||||||
|
"ksm.dev"
|
||||||
|
}
|
||||||
|
buttons[5] = {
|
||||||
|
settingsLabelImage, 247, Menu.Settings, "Adjust things",
|
||||||
|
"Open settings"
|
||||||
|
}
|
||||||
|
buttons[6] = {
|
||||||
|
exitLabelImage, 110, Menu.Exit, "Leave this cursed game",
|
||||||
|
"C'mon press that button!\nYou know you want to do it"
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function sign(x)
|
function drawHeader()
|
||||||
return x>0 and 1 or x<0 and -1 or 0
|
gfx.BeginPath();
|
||||||
|
gfx.FillColor(0, 0, 0, BAR_ALPHA);
|
||||||
|
gfx.Rect(0, 0, desw, HEADER_HEIGHT);
|
||||||
|
gfx.Fill();
|
||||||
|
gfx.ClosePath()
|
||||||
|
|
||||||
|
-- gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerTitleImage, 1, 0)
|
||||||
|
-- gfx.ImageRect(42, 14, 423*0.85, 80*0.85, headerGlowTitleImage, animationHeaderGlowAlpha, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function sign(x) return x > 0 and 1 or x < 0 and -1 or 0 end
|
||||||
|
|
||||||
function roundToZero(x)
|
function roundToZero(x)
|
||||||
if x<0 then return math.ceil(x)
|
if x < 0 then
|
||||||
elseif x>0 then return math.floor(x)
|
return math.ceil(x)
|
||||||
else return 0 end
|
elseif x > 0 then
|
||||||
|
return math.floor(x)
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function deltaKnob(delta)
|
function deltaKnob(delta)
|
||||||
if math.abs(delta) > 1.5 * math.pi then
|
if math.abs(delta) > 1.5 * math.pi then
|
||||||
return delta + 2 * math.pi * sign(delta) * -1
|
return delta + 2 * math.pi * sign(delta) * -1
|
||||||
end
|
end
|
||||||
return delta
|
return delta
|
||||||
end
|
end
|
||||||
|
|
||||||
local lastKnobs = nil
|
local lastKnobs = nil
|
||||||
local knobProgress = 0
|
local knobProgress = 0
|
||||||
function handle_controller()
|
function handle_controller()
|
||||||
if lastKnobs == nil then
|
if lastKnobs == nil then
|
||||||
lastKnobs = {game.GetKnob(0), game.GetKnob(1)}
|
lastKnobs = {game.GetKnob(0), game.GetKnob(1)}
|
||||||
else
|
else
|
||||||
local newKnobs = {game.GetKnob(0), game.GetKnob(1)}
|
local newKnobs = {game.GetKnob(0), game.GetKnob(1)}
|
||||||
|
|
||||||
knobProgress = knobProgress - deltaKnob(lastKnobs[1] - newKnobs[1]) * 1.2
|
knobProgress = knobProgress - deltaKnob(lastKnobs[1] - newKnobs[1]) *
|
||||||
knobProgress = knobProgress - deltaKnob(lastKnobs[2] - newKnobs[2]) * 1.2
|
1.2
|
||||||
|
knobProgress = knobProgress - deltaKnob(lastKnobs[2] - newKnobs[2]) *
|
||||||
|
1.2
|
||||||
|
|
||||||
lastKnobs = newKnobs
|
lastKnobs = newKnobs
|
||||||
|
|
||||||
if math.abs(knobProgress) > 1 then
|
if math.abs(knobProgress) > 1 then
|
||||||
cursorIndex = (((cursorIndex - 1) + roundToZero(knobProgress)) % #buttons) + 1
|
cursorIndex = (((cursorIndex - 1) + roundToZero(knobProgress)) %
|
||||||
|
#buttons) + 1
|
||||||
|
|
||||||
scrollTransitionScale = 0; -- Reset transitions and play them
|
scrollTransitionScale = 0; -- Reset transitions and play them
|
||||||
|
|
||||||
scrollingUp = false;
|
scrollingUp = false;
|
||||||
if ((cursorIndex > oldCursorIndex and not (cursorIndex == 6 and oldCursorIndex == 1)) or (cursorIndex == 1 and oldCursorIndex == 6)) then
|
if ((cursorIndex > oldCursorIndex and
|
||||||
scrollingUp = true;
|
not (cursorIndex == 6 and oldCursorIndex == 1)) or
|
||||||
end;
|
(cursorIndex == 1 and oldCursorIndex == 6)) then
|
||||||
|
scrollingUp = true;
|
||||||
|
end
|
||||||
|
|
||||||
game.PlaySample('titlescreen/cursor_change.wav');
|
game.PlaySample('titlescreen/cursor_change.wav');
|
||||||
|
|
||||||
oldCursorIndex = cursorIndex;
|
oldCursorIndex = cursorIndex;
|
||||||
|
|
||||||
knobProgress = knobProgress - roundToZero(knobProgress)
|
knobProgress = knobProgress - roundToZero(knobProgress)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
render = function(deltaTime)
|
render = function(deltaTime)
|
||||||
if not playedBgm then
|
if not playedBgm then
|
||||||
game.PlaySample('titlescreen/bgm.wav', true);
|
game.PlaySample('titlescreen/bgm.wav', true);
|
||||||
playedBgm = true;
|
playedBgm = true;
|
||||||
end
|
end
|
||||||
|
|
||||||
resetLayoutInformation();
|
resetLayoutInformation();
|
||||||
gfx.Scale(scale, scale);
|
gfx.Scale(scale, scale);
|
||||||
|
|
||||||
-- Draw background
|
-- Draw background
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, 0, desw, desh, bgImage, 1, 0);
|
gfx.ImageRect(0, 0, desw, desh, bgImage, 1, 0);
|
||||||
|
|
||||||
local idolAnimTickRes = gfx.TickAnimation(idolAnimation, deltaTime);
|
local idolAnimTickRes = gfx.TickAnimation(idolAnimation, deltaTime);
|
||||||
if idolAnimTickRes == 1 then
|
if idolAnimTickRes == 1 then
|
||||||
gfx.GlobalAlpha(idolAnimTransitionScale);
|
gfx.GlobalAlpha(idolAnimTransitionScale);
|
||||||
|
|
||||||
idolAnimTransitionScale = idolAnimTransitionScale + 1/60;
|
idolAnimTransitionScale = idolAnimTransitionScale + 1 / 60;
|
||||||
if (idolAnimTransitionScale > 1) then
|
if (idolAnimTransitionScale > 1) then
|
||||||
idolAnimTransitionScale = 1;
|
idolAnimTransitionScale = 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, 0, desw, desh, idolAnimation, 1, 0);
|
gfx.ImageRect(0, 0, desw, desh, idolAnimation, 1, 0);
|
||||||
gfx.GlobalAlpha(1);
|
gfx.GlobalAlpha(1);
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Draw selector background
|
-- Draw selector background
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(0, (desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER) - 280/2, 1079, 280, selectorBgImage, 1, 0);
|
gfx.ImageRect(0, (desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER) - 280 / 2,
|
||||||
|
1079, 280, selectorBgImage, 1, 0);
|
||||||
|
|
||||||
setButtons()
|
setButtons()
|
||||||
|
|
||||||
buttonY = (desh / 2) - 2 * (257 + 5);
|
buttonY = (desh / 2) - 2 * (257 + 5);
|
||||||
|
|
||||||
draw_buttons();
|
draw_buttons();
|
||||||
drawTexts();
|
drawTexts();
|
||||||
|
|
||||||
-- Draw the arrows around the selected button
|
-- Draw the arrows around the selected button
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
gfx.ImageRect(desw-512, desh/2 + SELECTOR_BAR_OFFSET_FROM_CENTER - buttonHeight - 8, 501, 300, selectorArrowsImage, 1, 0);
|
gfx.ImageRect(desw - 512, desh / 2 + SELECTOR_BAR_OFFSET_FROM_CENTER -
|
||||||
|
buttonHeight - 8, 501, 300, selectorArrowsImage, 1, 0);
|
||||||
|
|
||||||
-- Draw top and bottom bars
|
-- Draw top and bottom bars
|
||||||
--Bars.draw();
|
drawHeader();
|
||||||
|
Footer.draw();
|
||||||
|
|
||||||
handle_controller()
|
handle_controller()
|
||||||
|
|
||||||
scrollTransitionScale = scrollTransitionScale + 1/60 * 5;
|
scrollTransitionScale = scrollTransitionScale + 1 / 60 * 5;
|
||||||
if (scrollTransitionScale > 1) then
|
if (scrollTransitionScale > 1) then scrollTransitionScale = 1; end
|
||||||
scrollTransitionScale = 1;
|
|
||||||
end
|
|
||||||
|
|
||||||
if scrollingUp then
|
if scrollingUp then
|
||||||
buttonsMovementScale = 1-scrollTransitionScale
|
buttonsMovementScale = 1 - scrollTransitionScale
|
||||||
else
|
else
|
||||||
buttonsMovementScale = -1+scrollTransitionScale
|
buttonsMovementScale = -1 + scrollTransitionScale
|
||||||
end;
|
end
|
||||||
|
|
||||||
gfx.BeginPath();
|
gfx.BeginPath();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
mouse_pressed = function(button)
|
mouse_pressed = function(button) return 0 end
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
function button_pressed(button)
|
function button_pressed(button)
|
||||||
if button == game.BUTTON_STA then
|
if button == game.BUTTON_STA then
|
||||||
game.PlaySample('titlescreen/cursor_select.wav');
|
game.PlaySample('titlescreen/cursor_select.wav');
|
||||||
game.StopSample('titlescreen/bgm.wav');
|
game.StopSample('titlescreen/bgm.wav');
|
||||||
buttons[cursorIndex][3]()
|
buttons[cursorIndex][3]()
|
||||||
elseif button == game.BUTTON_BCK then
|
elseif button == game.BUTTON_BCK then
|
||||||
Menu.Exit()
|
Menu.Exit()
|
||||||
|
@ -338,6 +396,4 @@ function button_pressed(button)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- the thing is... titlescreen script does not have a call to reset function... WHYYYYY
|
-- the thing is... titlescreen script does not have a call to reset function... WHYYYYY
|
||||||
function reset()
|
function reset() playedBgm = false; end
|
||||||
playedBgm = false;
|
|
||||||
end
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 5.0 MiB After Width: | Height: | Size: 7.6 MiB |
Binary file not shown.
Before Width: | Height: | Size: 7.6 MiB |
Binary file not shown.
After Width: | Height: | Size: 5.0 MiB |
Loading…
Reference in New Issue