![]() |
BoB robotics
The Brains on Board robotics library
|
Class for reading from joysticks on Windows. More...
#include <joystick_windows.h>
Public Member Functions | |
JoystickWindows (float deadZone=0.0f) | |
Open default joystick device with (optionally) specified dead zone. | |
virtual bool | updateState () override |
![]() | |
bool | update () |
Try to read from the joystick. More... | |
void | addHandler (AxisHandler handler) |
Add a function to handle joystick axis events. | |
void | addHandler (ButtonHandler handler) |
Add a function to handle joystick button events. | |
float | getState (JAxisWindows axis) const |
Get the current value for a specified joystick axis. | |
unsigned char | getState (JButtonWindows button) const |
Get the current state for a specified joystick button. More... | |
bool | isDown (JButtonWindows button) const |
Whether button is currently being pressed. | |
bool | isPressed (JButtonWindows button) const |
Whether button has been pressed since last update() | |
bool | isReleased (JButtonWindows button) const |
Whether button has been released since last update() | |
![]() | |
virtual void | run () |
Run on the current thread, blocking until process ends. | |
virtual bool | isRunning () |
Check if the run() function has been called. | |
virtual void | runInBackground () |
Run the process on a background thread. | |
virtual void | stop () |
Stop the background thread. | |
Additional Inherited Members | |
![]() | |
static std::string | getName (JAxisWindows axis) |
Get the name of a specified joystick axis. | |
static std::string | getName (JButtonWindows button) |
Get the name of a specified joystick button. | |
![]() | |
JoystickBase (float deadZone=0.0f) | |
virtual bool | updateState ()=0 |
virtual void | runInternal () override |
void | setPressed (JButtonWindows button, bool isInitial) |
void | setReleased (JButtonWindows button, bool isInitial) |
void | setState (JButtonWindows button, uint8_t state, bool isInitial) |
void | setState (JAxisWindows axis, float value, bool isInitial) |
virtual void | runInternal ()=0 |
![]() | |
static constexpr size_t | toIndex (T value) |
static constexpr JAxisWindows | toAxis (T value) |
static constexpr JButtonWindows | toButton (T value) |
static constexpr float | int16_maxf () |
static constexpr float | int16_absminf () |
Class for reading from joysticks on Windows.
NOTE: This class should not be used directly; see example in joystick_test.
|
overridevirtual |