ExperimentalGear/scripts/titlescreen/service.lua

61 lines
1.6 KiB
Lua
Raw Normal View History

local Dim = require("common.dimensions")
local Wallpaper = require("components.wallpaper")
local PageView = require("components.pager.pageview")
2022-04-05 17:31:02 +02:00
local MainMenuPage = require("titlescreen.pages.service.mainmenupage")
--[[ WIP: REIMPLEMENTATION
2021-12-20 00:39:38 +01:00
local rootMenu = {
2022-03-12 15:18:41 +01:00
{label = "IDOLS", children = {{label = "GRACEv6"}, {label = "NEARNOAHv6"}, {label = "IDKv6"}}},
2021-12-20 00:39:38 +01:00
{
2022-03-12 15:18:41 +01:00
label = "LASER COLORS",
2021-12-20 00:39:38 +01:00
children = {
{
2022-03-12 15:18:41 +01:00
label = "LEFT LASER",
children = {
2022-03-12 15:18:41 +01:00
{label = "BLUE", color = {0, 128, 255}},
{label = "PINK", color = {255, 0, 255}},
{label = "GREEN", color = {0, 255, 0}},
{label = "YELLOW", color = {255, 255, 0}},
},
},
2021-12-20 00:39:38 +01:00
{
2022-03-12 15:18:41 +01:00
label = "RIGHT LASER",
children = {{label = "BLUE"}, {label = "PINK"}, {label = "GREEN"}, {label = "YELLOW"}},
},
},
2021-12-20 00:39:38 +01:00
},
}
]]
local currentpage = MainMenuPage.new()
local pageview = PageView.new(currentpage)
local function reset()
pageview = PageView.new(currentpage)
end
2021-12-20 00:39:38 +01:00
local function render(deltaTime)
Dim.updateResolution()
Wallpaper.render()
Dim.transformToScreenSpace()
pageview:render(deltaTime)
--pageview will be empty when you `back()` out of the root page
if not pageview:get() then
2022-03-12 15:18:41 +01:00
return {eventType = "switch", toScreen = "splash"}
2021-12-20 00:39:38 +01:00
end
end
local function onButtonPressed(button)
pageview:get():handleButtonInput(button)
2021-12-20 00:39:38 +01:00
end
return {reset = reset, render = render, onButtonPressed = onButtonPressed}