51 static const int NUM_AXES = 4;
55 CENTERED = 0x00000000,
60 NORTHEAST = 0x00000101,
61 SOUTHEAST = 0x00000110,
62 NORTHWEST = 0x00001001,
63 SOUTHWEST = 0x00001010
82 State(
const OIS::JoyStickState& oisState );
139 OIS::JoyStick* m_oisJoystick;
142 bool m_forceFeedbackFound;
155 static int const NUM_AXES = Joystick::State::NUM_AXES;
159 CENTERED = 0x00000000,
164 NORTHEAST = 0x00000101,
165 SOUTHEAST = 0x00000110,
166 NORTHWEST = 0x00001001,
167 SOUTHWEST = 0x00001010
217 : m_mask( ALL ), m_manager( nullptr ) {}
224 : m_mask( mask ), m_manager( nullptr ) {}
331 bool valid()
const {
return m_initialized; }
383 OIS::JoyStick* m_oisJoystick;
Simulation * getSimulation()
Derive from this class to implement a listener for simulation step events.
Class that can be used to listen to events generated by a GamePad or Joystick.
JoystickListener()
Default constructor for a joystick listener.
virtual bool axisUpdate(const agxSensor::JoystickState &state, int axis)
Called when the manager has a new joystick state.
JoystickManager * getManager()
virtual bool buttonChanged(const agxSensor::JoystickState &state, int button, bool down)
Called when button button changed state.
virtual void removeNotification()
Called when this listener has been removed from a JoystickManager.
virtual bool sliderMoved(const agxSensor::JoystickState &state, int slider)
Called when slider slider has changed state.
virtual void addNotification()
Called when this listener has been added to a JoystickManager.
const JoystickManager * getManager() const
void setMask(int mask)
Assign new callback mask to this listener.
virtual bool povMoved(const agxSensor::JoystickState &state, int pov)
Called when POV button pov has changed state.
virtual ~JoystickListener()
JoystickListener(int mask)
Create joystick listener given a callback mask (default ALL).
A Joystick/GamePad manager that initializes the connected devices and allows for adding listeners.
virtual void pre(const agx::TimeStamp &)
Makes a capture of the joystick and fires callbacks.
virtual void addNotification()
Creates the device if not already created.
bool inSimulation() const
virtual void povCallback(const agxSensor::JoystickState &state, int pov)
Internal method.
virtual void buttonCallback(const agxSensor::JoystickState &state, int button, bool down)
Internal method.
JoystickManager(intptr_t hwnd)
virtual void removeNotification()
Destroys the device and all listeners.
virtual ~JoystickManager()
bool remove(JoystickListener *listener)
Remove joystick listener.
agx::Real normalize(int axisValue) const
Normalizes axis value [-1, 1].
JoystickState getState() const
bool add(JoystickListener *listener)
Add new joystick listener.
Store the current state of a Joystick/GamePad.
agx::Int32Vector slidersY
Contains the values for all sliders Y coordinate. Maximum of 4.
Pov
Bit masks indicating the state of the POV button.
agx::Int32Vector pov
Represents the value of POV button. Maximum of 4.
agx::Int32Vector axes
Contains the values for all axes.
agx::Int32Vector slidersX
Contains the values for all sliders X coordinate. Maximum of 4.
JoystickState(const OIS::JoyStickState &oisState)
Copies state from device driver.
agx::BoolVector buttons
Contains the state (in/out) of all buttons.
Class for storing a Joystick state.
agx::BoolVector buttons
Contains the state (in/out) of all buttons.
agx::Int32Vector pov
Represents the value of POV button. Maximum of 4.
agx::Int32Vector slidersX
Contains the values for all sliders X coordinate. Maximum of 4.
Pov
Bitmasks indicating the state of the POV button.
agx::Int32Vector slidersY
Contains the values for all sliders Y coordinate. Maximum of 4.
agx::Int32Vector axes
Contains the values for all axes.
State(const OIS::JoyStickState &oisState)
Copies state from device driver.
Alternative Joystick interface for gamepads etc.
agx::Real normalize(int axisValue) const
Normalizes axis value [-1, 1].
virtual bool povMoved(const State &arg, int pov)=0
Called whenever an POV button is moved.
virtual bool sliderMoved(const State &arg, int index)=0
Called whenever an slider is moved.
virtual void pre(const agx::TimeStamp &)
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
virtual bool axisMoved(const State &arg, int axis)=0
Called whenever an axis control is moved.
virtual void addNotification()
Called when this listener is added to the simulation.
bool init()
Initializes the joystick.
virtual void removeNotification()
Called when this listener is removed from the simulation.
virtual bool buttonChanged(const State &arg, int button, bool down)=0
Called whenever a button is pressed or released on a Joystick.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Base class providing referencing counted objects.
Vector containing 'raw' data.
Smart pointer for handling referenced counted objects.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
The agxSensor namespace contains drivers for reading for devices such as Gamepad.