Skip to content

Add support for terminating/locking/unlocking/sleep callback #55

Open
@GammaGames

Description

Describe the feature
Someone on the discord discovered a catalog game that had an exit animation and implemented it in their own game:

Playdate_2023-07-24_222512.mp4

They don't use Noble, but they shared their code and it was surprisingly simple. I think it would be nice to easily support it on a per-scene basis. The other use for the function is to save data when the device does the thing.

Describe alternatives you've considered
You could do it manually, which is what I'm doing now.

What problems would this solve or help prevent, if any
It would show off the lesser-known parts of the SDK and easier saving when not using autosave on a per-scene basis

Additional context
Here's my case scene:

class("BaseScene").extends(NobleScene)

function BaseScene:enter()
    BaseScene.super.enter(self)

    function pd.gameWillTerminate() self:terminate() end
    function pd.deviceWillSleep() self:sleep() end
    function pd.deviceWillLock() self:lock() end
    function pd.deviceDidUnlock() self:unlock() end
end

function BaseScene:exit()
    BaseScene.super.exit(self)

    function pd.gameWillTerminate() end
    function pd.deviceWillSleep() end
    function pd.deviceWillLock() end
    function pd.deviceDidUnlock() end
end

function BaseScene:terminate() end
function BaseScene:sleep() end
function BaseScene:lock() end
function BaseScene:unlock() end

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    • Status

      To-do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions