55 lines
1.4 KiB
Lua
55 lines
1.4 KiB
Lua
require "common.globals"
|
|
|
|
local Version = require "common.version"
|
|
local Display = require "scripts.graphics.display"
|
|
|
|
local Image = require "scripts.graphics.image"
|
|
|
|
local Page = require "api.page.page"
|
|
|
|
local versionString = Version.long_version()
|
|
|
|
---@class TitlePage : Page
|
|
---@field background_img Image
|
|
local TitlePage = {
|
|
__name = "TitlePage",
|
|
BACKGROUND_IMG_PATH = "titlescreen/title/background.png",
|
|
}
|
|
|
|
function TitlePage.new(params)
|
|
local self = CreateInstance(TitlePage, params, Page)
|
|
|
|
self.background_img = Image.new(self.BACKGROUND_IMG_PATH)
|
|
self.background_img:setPosition(0, 0)
|
|
self.background_img:setSize(Display.design.width, Display.design.height)
|
|
|
|
return self
|
|
end
|
|
|
|
function TitlePage:handleButtonInput(button)
|
|
if button == game.BUTTON_FXR and game.GetButton(game.BUTTON_FXL) or
|
|
button == game.BUTTON_FXL and game.GetButton(game.BUTTON_FXR) then
|
|
self:onInvalidation(true) -- true to switch to service menu
|
|
end
|
|
|
|
if button == game.BUTTON_STA then
|
|
self:onInvalidation()
|
|
end
|
|
end
|
|
|
|
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
|
|
|
|
return TitlePage
|