C API - how does one plot a pixel?

I've done a bunch of searching the C API docs, interwebs and this forum and can't seem to find an API to draw a pixel on the screen. Did I overlook something? Is there a native API to plot a pixel, like pd->graphics->drawPixel(x, y, color);?

check this, you need to get the bitmapdata first (or the data of the screenbuffer)


It's pretty silly that we don't have that in the C API (because the function overhead makes it a lot less efficient than accessing the bits directly) but we do in Lua where there's even more overhead. :thinking:

I've filed an issue for that, will add the function but also point out in the docs that it's faster access the data buffer directly

1 Like

Thank you. I imagine this was likely an oversight of some sort, given how trivial it should be to implement.

It might make sense to add a note to the docs that mentions how it is not as fast as accessing & writing to the screen buffer directly. I imagine it will help new devs write simple stuff allowing them to learn the platform a little better. =)

Do you think the SDK could include macros for drawing pixels, and documentation on how to use them?