+ service menu

This commit is contained in:
FajsiEx 2021-12-20 00:39:38 +01:00
parent e2c8403a92
commit bd967aeef1
4 changed files with 120 additions and 1 deletions

View File

@ -1,5 +1,6 @@
local splashScreen = require('titlescreen.splash');
local modeSelectScreen = require('titlescreen.mode_select');
local serviceScreen = require('titlescreen.service');
local screens = {
splash = {
@ -7,6 +8,9 @@ local screens = {
},
mode_select = {
screen = modeSelectScreen
},
service = {
screen = serviceScreen
}
}
@ -25,7 +29,7 @@ end
function render(deltaTime)
handle_controller();
local res = currentScreen.screen.render(deltaTime)
if res then
handleScreenResponse(res)

View File

@ -68,6 +68,8 @@ local oldCursorIndex = 3;
local scrollingUp = false;
local playedBgm = false;
local triggerServiceMenu = false
-- Window variables
local resX, resY
@ -390,6 +392,14 @@ local render = function(deltaTime)
buttonsMovementScale = -1 + scrollTransitionScale
end
if (triggerServiceMenu) then
triggerServiceMenu = false;
return {
eventType = 'switch',
toScreen = 'service'
}
end
gfx.BeginPath();
end;
@ -400,6 +410,8 @@ local onButtonPressed = function(button)
buttons[cursorIndex][3]()
elseif button == game.BUTTON_BCK then
Menu.Exit()
elseif button == game.BUTTON_FXR then
triggerServiceMenu = true;
end
end

View File

@ -0,0 +1,102 @@
local triggerSplashScreen = false
local menu = {
{
label = 'IDOLS',
handler = function () return end;
children = {
{
label = 'TEST'
}
}
},
{
label = 'LASER COLORS',
handler = function () return end;
children = {
{
label = 'TEST'
}
}
},
{
label = 'MORE OPTIONS',
handler = function () return end;
children = {
{
label = 'TEST'
}
}
},
{
label = 'OH YOU SUSSY BAKA',
handler = function () return end;
children = {
{
label = 'TEST'
}
}
},
{
label = "GAME MODE",
handler = function ()
triggerSplashScreen = true;
end
}
}
local index = 1;
render = function (deltaTime)
gfx.BeginPath();
gfx.FillColor(0,0,0,255);
gfx.Rect(0, 0, 1080, 1920);
gfx.Fill();
gfx.LoadSkinFont("dfmarugoth.ttf")
gfx.FillColor(255,255,255,255);
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE)
gfx.FontSize(24);
gfx.BeginPath();
gfx.Text('SERIVCE MENU', 1080/2, 128);
gfx.Text('BT-A/BT-B = GO UP/DOWN', 1080/2, 1920-256-28);
gfx.Text('START = SELECT', 1080/2, 1920-256);
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
for i, menuItem in ipairs(menu) do
if (i == index) then
gfx.FillColor(0,255,0,255);
-- gfx.FillColor(0,128,255,255);
else
gfx.FillColor(255,255,255,255);
end
gfx.BeginPath();
gfx.Text(menuItem.label, 100, 256+i*28);
end
if (triggerSplashScreen) then
triggerSplashScreen = false;
return {
eventType = 'switch',
toScreen = 'splash'
}
end
end
local onButtonPressed = function(button)
if button == game.BUTTON_STA then
menu[index].handler();
elseif button == game.BUTTON_BTA then
index = index - 1;
elseif button == game.BUTTON_BTB then
index = index + 1;
end
end
return {
render = render,
onButtonPressed = onButtonPressed
}

View File

@ -10,6 +10,7 @@ render = function (deltaTime)
splashTimer = splashTimer - deltaTime
if (splashTimer < 0) then
splashTimer = 2;
return {
eventType = 'switch',
toScreen = 'mode_select'