Support mutiple colors in debugDraw

I have debug visualizations for various bits of data in my game such as collision info, object origins, target vectors, etc.

When I have many of these active at once (like when when working on AI behaviors) it can be tricky to see the difference between them when they're all rendered in the same color.


(I realize this particular screenshot isn't like super difficult to parse but it's an example of the different types of visualization I use. When I add in tile collisions and targeting vectors its a lot.)

I would love to be able to specify different colors when doing debug drawing so I can have collision rects all one color, sensors another, AI info another, and so on.

2 Likes

You can change the debug draw color using this API playdate.setDebugDrawColor(). That said, it's currently broken in the Mac Sim but works in Windows/Linux.

Ahh gotcha. In that case consider this a friendly request to fix multiple color support on the macOS simulator. :slight_smile:

1 Like

Actually, I just tested it and it does work, it just works a bit differently than the win/linux version. It needs to be set inside the debugDraw() function.

Maybe I was a bit unclear before or misunderstanding the behavior. Are you able to get multiple debug colors to show at the same time?

For example, I'd like to render the object origin dots blue while at the same time rendering collision rects yellow, sensor rects red, and target vectors white with a black circle at the end.

When I test that sort of behavior, all of the primitives I draw in a given frame share the color of whatever the last call to playdate.setDebugDrawColor() was.

This is on the 1.11.0 sim on macOS. I cannot figure out a way to get the debug drawing to show more than one color at a time. I am able to change the color of all drawing at once to whatever color I want.

Ah, news to me, this is a current limitation of the Sim and the way it composites the debug frame buffer. We'll look into adding support for this.

3 Likes

Thanks very kindly for taking the time. :slight_smile:

Would also find this very useful.

Jumping in to +1 this too!