2022-06-29 00:35:52 +02:00
|
|
|
require "common.globals"
|
2021-12-21 19:39:34 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
local Version = require "common.version"
|
|
|
|
local Dim = require "common.dimensions"
|
2021-12-21 19:49:11 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
local Image = require "api.image"
|
2021-12-21 19:39:34 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
local Page = require "api.page.page"
|
2021-12-21 19:39:34 +01:00
|
|
|
|
2023-08-19 04:25:27 +02:00
|
|
|
local versionString = Version.long_version()
|
2022-04-04 01:58:10 +02:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
---@class TitlePage : Page
|
|
|
|
---@field background_img Image
|
|
|
|
local TitlePage = {
|
|
|
|
__name = "TitlePage",
|
|
|
|
BACKGROUND_IMG_PATH = "titlescreen/title/background.png",
|
|
|
|
}
|
2021-12-21 19:39:34 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
function TitlePage.new(params)
|
|
|
|
local self = CreateInstance(TitlePage, params, Page)
|
2022-03-04 04:06:19 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
self.background_img = Image.new(self.BACKGROUND_IMG_PATH)
|
|
|
|
self.background_img:setPosition(0, 0)
|
|
|
|
self.background_img:setSize(Dim.design.width, Dim.design.height)
|
2022-03-04 04:06:19 +01:00
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
return self
|
2021-12-21 19:39:34 +01:00
|
|
|
end
|
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
function TitlePage:handleButtonInput(button)
|
2022-03-12 15:18:24 +01:00
|
|
|
if button == game.BUTTON_FXR and game.GetButton(game.BUTTON_FXL) or
|
|
|
|
button == game.BUTTON_FXL and game.GetButton(game.BUTTON_FXR) then
|
2022-06-29 00:35:52 +02:00
|
|
|
self:onInvalidation(true) -- true to switch to service menu
|
2022-03-12 15:18:24 +01:00
|
|
|
end
|
|
|
|
|
2021-12-21 19:39:34 +01:00
|
|
|
if button == game.BUTTON_STA then
|
2022-06-29 00:35:52 +02:00
|
|
|
self:onInvalidation()
|
2021-12-21 19:39:34 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-06-29 00:35:52 +02:00
|
|
|
function TitlePage:drawBackground(deltaTime)
|
|
|
|
self.background_img:render()
|
|
|
|
end
|
|
|
|
|
|
|
|
function TitlePage:drawForeground(deltaTime)
|
|
|
|
gfx.LoadSkinFont("segoeui.ttf")
|
|
|
|
gfx.FillColor(255, 255, 255)
|
|
|
|
gfx.StrokeColor(0, 0, 0)
|
|
|
|
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
|
|
|
|
gfx.FontSize(28)
|
|
|
|
gfx.StrokeWidth(1)
|
|
|
|
gfx.Text(versionString, 10, 10)
|
|
|
|
end
|
|
|
|
|
2023-08-19 04:25:27 +02:00
|
|
|
return TitlePage
|