noble engine migration
This commit is contained in:
32
source/scenes/BaseScene.lua
Normal file
32
source/scenes/BaseScene.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
Reference in New Issue
Block a user