Debug-Draw - Lines, boxes, circles, etc

I made a little module of convenience functions to help draw lines, shapes, and text for visual debugging. The render “draw_line” and “draw_text” messages are really long and cumbersome to type, so this wraps them up and makes things simple. It’s not an exhaustive shape-drawing library, just enough to draw a few different kinds of indicators and things.

You can use it as a library dependency with the following link, or just grab the lua file and drop it in your project wherever suits you.

https://github.com/rgrams/debug-draw/archive/master.zip

See the Readme on github for documentation (though it’s all pretty straightforward).

25 Likes

Add it to our asset portal, it’s great and convenient :smiley:

2 Likes

Yeah I know. :stuck_out_tongue: Since the dashboard’s going to be removed and the asset portal shuffled around in a few weeks I figured I might as well wait.

3 Likes

Hello!

I just discovered your library, it looks soooo convenient!

I just followed the instructions here (https://defold.com/manuals/libraries/), but… can’t make it work :frowning:

The library seems to be properly installed:
debugdraw001

But this simple line…
debugdraw.circle(100,100,100) (in the “update” function)

… generates an error message:
debugdraw002

Did I miss something?

Rag’

1 Like

How do you “require” the Lua module?

1 Like

require "debug-draw.debug-draw"

1st line of the same script

:thinking:

1 Like

Then you’ll get the variable “debug-draw”, and not the “debugdraw” as you wrote.

Try this instead:

local debugdraw = require("debug-draw.debug-draw")
4 Likes

Oh ok… As you expected, it works :slight_smile:

Thank you very much Ross for this super useful library, and Mathias for the help!

2 Likes

Thanks Mathias for helping out. I’ve added a line about this to the readme.

2 Likes