|
AGX Dynamics 2.42.3.1
|
Class that can be used to listen to events generated by a GamePad or Joystick. More...
#include <Joystick.h>
Inheritance diagram for agxIO::JoystickListener:Public Types | |
| enum | CallbackMask { BUTTON = (1<<0) , AXIS = (1<<1) , POV = (1<<2) , SLIDER = (1<<3) , ALL } |
Public Member Functions | |
| JoystickListener () | |
| Default constructor for a joystick listener. | |
| JoystickListener (int mask) | |
| Create joystick listener given a callback mask (default ALL). | |
| virtual void | addNotification () |
| Called when this listener has been added to a JoystickManager. | |
| virtual bool | axisUpdate (const agxIO::JoystickState &state, int axis) |
| Called when the manager has a new joystick state. | |
| virtual bool | buttonChanged (const agxIO::JoystickState &state, int button, bool down) |
Called when button button changed state. | |
| int | getMask () const |
| virtual bool | povMoved (const agxIO::JoystickState &state, int pov) |
Called when POV button pov has changed state. | |
| virtual void | removeNotification () |
| Called when this listener has been removed from a JoystickManager. | |
| void | setMask (int mask) |
| Assign new callback mask to this listener. | |
| virtual bool | sliderMoved (const agxIO::JoystickState &state, int slider) |
Called when slider slider has changed state. | |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Protected Member Functions | |
| virtual | ~JoystickListener () |
| JoystickManager * | getManager () |
| const JoystickManager * | getManager () const |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Additional Inherited Members | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
Class that can be used to listen to events generated by a GamePad or Joystick.
Override the virtual methods to receive events with the current state of the device.
Definition at line 203 of file Joystick.h.
| Enumerator | |
|---|---|
| BUTTON | |
| AXIS | |
| POV | |
| SLIDER | |
| ALL | |
Definition at line 206 of file Joystick.h.
|
inline |
Default constructor for a joystick listener.
Default listens to all.
Definition at line 221 of file Joystick.h.
|
inline |
Create joystick listener given a callback mask (default ALL).
| mask | - callback mask (e.g., AXIS or (BUTTON | AXIS)) |
Definition at line 228 of file Joystick.h.
|
inlineprotectedvirtual |
Definition at line 287 of file Joystick.h.
|
inlinevirtual |
Called when this listener has been added to a JoystickManager.
Definition at line 268 of file Joystick.h.
|
virtual |
Called when the manager has a new joystick state.
This means that the value of the axis could be identical between different calls.
| state | - current state of the joystick |
| axis | - axis to check |
|
virtual |
Called when button button changed state.
| state | - current state of the joystick |
| button | - the button pressed or released |
| down | - true if button is down, otherwise false |
|
inlineprotected |
Definition at line 292 of file Joystick.h.
|
inlineprotected |
Definition at line 293 of file Joystick.h.
|
inline |
Definition at line 284 of file Joystick.h.
References agxSDK::EventListener::m_mask.
|
virtual |
Called when POV button pov has changed state.
| state | - current joystick state |
| pov | - POV that has changed state (state.pov[pov]) |
|
inlinevirtual |
Called when this listener has been removed from a JoystickManager.
Definition at line 273 of file Joystick.h.
|
inline |
Assign new callback mask to this listener.
| mask | - new callback mask |
Definition at line 279 of file Joystick.h.
|
virtual |
Called when slider slider has changed state.
| state | - current joystick state |
| slider | - slider that has changed state (state.slider[pov]) |