Crank indicator in C SDK?

,

Hello,

I'm currently writing a game purely using the C SDK, and need to display the crank indicator.

As it is not available in the C SDK, I have to include the Lua runtime just to be able to invoke the draw method from C.
I was wondering if adding the indicator directly to the C SDK has been considered?

If not, given that its source code is relatively short and (I'm assuming) pretty stable at this point I'm considering converting it to C. Happy to share it if I do (and maybe have it be officially included in the SDK?).

Two tangential questions:

  • Does including the Lua runtime vs the complete bypass have an impact on performance / memory usage?
  • The indicator is shown using playdate.ui.crankIndicator:draw() in Lua, but it does not seem possible to call it directly from C as it seems to be missing the implicit first argument. So I had to create a Lua function that itself just calls playdate.ui.crankIndicator:draw(). Not a big deal but I was wondering if there was a simple way around that?

Cheers!

I don't know if you have ported it yourself or not, but here is a port I did a week or so ago. You need to make sure to copy the crank folder from the SDK corelibs into your Source folder under images or you can change the path in crank_indicator.c line 61
call initCrankIndicator in your setup (you can call it again if you display scale changes.)

also if you need Raphcal did a port of the keyboard.

Thanks @DraperDanMan! I actually ended up making my own port, but still grateful you shared yours. And many thanks for linking to Raphcal's keyboard port (and to Raphcal for doing it), I will need it and hadn't realised it's missing from the C SDK as well... Why, Panic?!

2 Likes