"Degree Offset" for playdate.getCrankTicks


I feel like an optional argument to offset the degrees that ticks land on while using playdate.getCrankTicks() would be a nice feature to have. So instead of the first tick always starting at 0º, it would start at 0º (if unset) OR the specified offset number (from 0 to 360).

For example, to set up a situation with two crank ticks that each triggered at 90º and 270º, you could write playdate.getCrankTicks(2, 90) to give each tick a 90º offset and obtain the desired result.

Another example from a project I'm working on: I have this selection screen that uses the crank to switch between a few different options. The wheel is on a 45º offset to the crank's raw position (so a real-world crank position of 0º would land you smack in the center of an option, instead of at the edge between two of them.)
A weapon selection screen in a Playdate game. There's a wheel along the bottom screen that rotates depending on the crank's position.
To get selection logic working how I'd like using the ticks system, I'd need to set up four ticks each set at a 45º offset. Currently, I set up a custom adaptation of the ticks function to handle this offset. If this feature were to be included in the SDK itself, it could be written as playdate.getCrankTicks(4, 45).

I think this'd be a nice comfort feature to have, just to allow that much more flexibility when it comes to reading the crank.

1 Like