1#ifndef __BINDJOYSTICK_HPP
2#define __BINDJOYSTICK_HPP
4#include "BindUtils.hpp"
63 this->tag = tagIndex++;
87 changeCallback = callback;
90 void invokeCallback(int16_t xIn, int16_t yIn)
94 if (changeCallback !=
nullptr)
96 changeCallback(xIn, yIn);
111 copyAndOffset(out, &offset, &objID,
sizeof(objID));
112 copyAndOffset(out, &offset, &
x,
sizeof(
x));
113 copyAndOffset(out, &offset, &
y,
sizeof(
y));
114 copyAndOffset(out, &offset, &tag,
sizeof(tag));
115 copyAndOffset(out, &offset, &
cmdId,
sizeof(
cmdId));
122 uint8_t objID = BIND_ID_JOYSTICK;
124 static int16_t tagIndex;
125 void (*changeCallback)(int16_t, int16_t) =
nullptr;
BindJoystick Class.
Definition BindJoystick.hpp:58
int16_t sX
The joystick's current X-axis position (internal).
Definition BindJoystick.hpp:70
int16_t y
The y-coordinate position of the joystick on the screen.
Definition BindJoystick.hpp:67
int16_t x
The x-coordinate position of the joystick on the screen.
Definition BindJoystick.hpp:66
int16_t dimSize
The dimensions (size) of the joystick.
Definition BindJoystick.hpp:69
uint8_t cmdId
Command identifier to add or refresh the joystick. See the notes for possible cmdId values.
Definition BindJoystick.hpp:68
bool springed
Indicates whether the joystick returns to the center automatically when released.
Definition BindJoystick.hpp:72
void setCallback(void(*callback)(int16_t, int16_t))
Set the Callback function for the joystick.
Definition BindJoystick.hpp:85
uint16_t getBytes(uint8_t *out) override
Serialize the joystick object into bytes.
Definition BindJoystick.hpp:108
int16_t sY
The joystick's current Y-axis position (internal).
Definition BindJoystick.hpp:71
Definition BindView.hpp:22