SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::core::objectmodel::JoystickEvent::AxisEvent Class Reference

#include <JoystickEvent.h>

Implements an event that notifies about axis positions (like analog controls of a joystick). The axis position is normalized so values are always in the range [-1, 1]. More...

Detailed Description

Implements an event that notifies about axis positions (like analog controls of a joystick). The axis position is normalized so values are always in the range [-1, 1].

Public Member Functions

 AxisEvent (const int, const float)
 Constructor. More...
 
virtual ~AxisEvent ()
 Default destructor. More...
 
virtual const char * getClassName () const
 
Accessors
int getIndex () const
 Retrieves the index of the axis. More...
 
float getValue () const
 Retrieves the value of the axis. More...
 

Constructor details

sofa::core::objectmodel::JoystickEvent::AxisEvent::AxisEvent ( const int  index,
const float  value 
)

Constructor.

Parameters
indexaxis' index
valueaxis' value (must be in the range [-1, 1])
Precondition
(value >= -1.f) && (value <= 1.f)
sofa::core::objectmodel::JoystickEvent::AxisEvent::~AxisEvent ( )
virtual

Default destructor.

Function details

virtual const char* sofa::core::objectmodel::JoystickEvent::AxisEvent::getClassName ( ) const
inlinevirtual
int sofa::core::objectmodel::JoystickEvent::AxisEvent::getIndex ( ) const

Retrieves the index of the axis.

Returns
the axis' index
float sofa::core::objectmodel::JoystickEvent::AxisEvent::getValue ( ) const

Retrieves the value of the axis.

Remarks
Values are always in the range [-1, 1].
Returns
the axis' value