Skip to content

Add support for debugDraw in scenes #53

@GammaGames

Description

@GammaGames

Describe the feature
It would be nice if I could set a function's debug draw function similar to scene:drawBackground. The color could also be set like scene.debugColor, (and then pd.setDebugDrawColor(r, g, b, a)) so it's like background.

Describe alternatives you've considered
I could add it my own, and rn I'm going to do it by manually adding it in my scene:enter and scene:exit for my base scene

What problems would this solve or help prevent, if any
It would be cool, and I'm adding a debug system menu toggle that I want to use. Having a

Additional context
Here's what I'm currently doing in my BaseScene.lua:

BaseScene.debugColor = {1, 0, 0, 0.5}

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

    pd.setDebugDrawColor(table.unpack(self.debugColor))
    function playdate.debugDraw()
        self:drawDebug()
    end
end

function BaseScene:exit()
    BaseScene.super.exit(self)
    
    function playdate.debugDraw() end
end

function BaseScene:drawDebug() end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions