17 #ifndef AGXSENSOR_JOYSTICK_H
18 #define AGXSENSOR_JOYSTICK_H
54 CENTERED = 0x00000000,
59 NORTHEAST = 0x00000101,
60 SOUTHEAST = 0x00000110,
61 NORTHWEST = 0x00001001,
62 SOUTHWEST = 0x00001010
81 State(
const OIS::JoyStickState& oisState );
93 virtual bool buttonChanged(
const State &arg,
int button,
bool down ) =0;
100 virtual bool axisMoved(
const State &arg,
int axis ) =0;
107 virtual bool povMoved(
const State &arg,
int pov ) =0;
114 virtual bool sliderMoved(
const State &arg,
int index) =0;
127 agx::Real normalize(
int axisValue )
const;
129 State getState()
const;
138 OIS::JoyStick* m_oisJoystick;
141 bool m_forceFeedbackFound;
146 class JoystickManager;
153 CENTERED = 0x00000000,
158 NORTHEAST = 0x00000101,
159 SOUTHEAST = 0x00000110,
160 NORTHWEST = 0x00001001,
161 SOUTHWEST = 0x00001010
212 : m_mask( ALL ), m_manager( nullptr ) {}
219 : m_mask( mask ), m_manager( nullptr ) {}
332 bool valid()
const {
return m_initialized; }
349 agx::Real normalize(
int axisValue )
const;
369 virtual void addNotification();
374 virtual void removeNotification();
384 OIS::JoyStick* m_oisJoystick;
agx::ref_ptr< JoystickListener > JoystickListenerRef
agx::Int32Vector axes
Contains the values for all axes.
void AGXPHYSICS_EXPORT init()
Initialize agx.
JoystickListener()
Default constructor for a joystick listener.
Derive from this class to implement a listener for simulation Step events.
Joystick interface for gamepads etc.
virtual void removeNotification()
Called when this listener has been removed from a JoystickManager.
virtual void removeNotification()
Called when this listener is removed from the simulation.
agx::HashVector< JoystickListener *, JoystickListenerRef > JoystickListenerContainer
virtual void addNotification()
Called when this listener has been added to a JoystickManager.
virtual void addNotification()
Called when this listener is added to the simulation.
agx::ref_ptr< JoystickManager > JoystickManagerRef
Class for storing a Joystick state.
virtual ~JoystickListener()
bool inSimulation() const
const JoystickManager * getManager() const
Base class providing referencing counted objects.
agx::Int32Vector axes
Contains the values for all axes.
Vector containing 'raw' data.
void setMask(int mask)
Assign new callback mask to this listener.
Pov
Bit masks indicating the state of the POV button.
agx::BoolVector buttons
Contains the state (in/out) of all buttons.
Smart pointer for handling referenced counted objects.
JoystickManager * getManager()
Pov
Bitmasks indicating the state of the POV button.
agx::BoolVector buttons
Contains the state (in/out) of all buttons.
virtual void pre(const agx::TimeStamp &time)
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
JoystickListener(int mask)
Create joystick listener given a callback mask (default ALL).