Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Functions | |
void | getTouchCartesian (int32_t angle, int32_t radius, int32_t *x, int32_t *y) |
Convert touchpad angle and radius to cartesian coordinates. | |
touchJoystick_t | getTouchJoystickZones (int32_t angle, int32_t radius, bool useCenter, bool useDiagonals) |
Convert touchpad angle and radius to a joystick enum, with either 4 or 8 directions and an optional center dead-zone. | |
void | getTouchSpins (touchSpinState_t *state, int32_t angle, int32_t radius) |
Calculate the number of times the touchpad was circled. | |
void getTouchCartesian | ( | int32_t | angle, |
int32_t | radius, | ||
int32_t * | x, | ||
int32_t * | y ) |
Convert touchpad angle and radius to cartesian coordinates.
angle | The touchpad angle to convert | |
radius | The touchpad radius to convert | |
[out] | x | A pointer to be set to the X touch coordinate, from 0 to 1023 |
[out] | y | A pointer to be set to the Y touch coordinate, from 0 to 1023 |
touchJoystick_t getTouchJoystickZones | ( | int32_t | angle, |
int32_t | radius, | ||
bool | useCenter, | ||
bool | useDiagonals ) |
Convert touchpad angle and radius to a joystick enum, with either 4 or 8 directions and an optional center dead-zone.
angle | The touch angle reported by getTouchJoystick() |
radius | The touch radius reported by getTouchJoystick() |
useCenter | If true, TB_CENTER will be returned if the stick is touched but inside the dead-zone |
useDiagonals | If true, diagonal directions will be returned as the bitwise OR of two directions |
void getTouchSpins | ( | touchSpinState_t * | state, |
int32_t | angle, | ||
int32_t | radius ) |
Calculate the number of times the touchpad was circled.
When the touch is done, reset startSet to 0
[in,out] | state | A pointer to a touchSpinState_t to use for state. |
angle | The current angle of the touch | |
radius | The current radius of the touch |