fpv/source/scenes/BaseScene.lua
2024-06-14 20:33:09 +03:00

32 lines
872 B
Lua

local pd <const> = playdate
local gfx <const> = Graphics
BaseScene = {}
class("BaseScene").extends(NobleScene)
function BaseScene:init()
BaseScene.super.init(self)
pd.resetElapsedTime() -- Reset time so each scene starts at 0
self.optionsMenu = pd.getSystemMenu() -- Store this so we have access to it in all scenes
end
function BaseScene:update()
BaseScene.super.update(self)
Particles:update()
end
function BaseScene:exit()
BaseScene.super.exit(self)
self.optionsMenu:removeAllMenuItems() -- Remove all custom menu items and reset menu image
pd.setMenuImage(nil)
end
function BaseScene:drawBackground()
BaseScene.super.drawBackground(self)
if self.background ~= nil then -- Helper so you can set a scene's background to an image
self.background:draw(0, 0)
end
end