fpv/source/scenes/BaseScene.lua

32 lines
889 B
Lua
Raw Permalink Normal View History

2024-06-01 16:52:11 +03:00
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() -- Update our particle library
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