SOFA API  1a4bb3e7
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...
 

Accessors

int getIndex () const
 Retrieves the index of the axis. More...
 
float getValue () const
 Retrieves the value of the axis. More...
 
virtual const chargetClassName () const
 

Constructor details

◆ AxisEvent()

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)

◆ ~AxisEvent()

sofa::core::objectmodel::JoystickEvent::AxisEvent::~AxisEvent ( )
virtual

Default destructor.

Function details

◆ getClassName()

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

◆ getIndex()

int sofa::core::objectmodel::JoystickEvent::AxisEvent::getIndex ( ) const

Retrieves the index of the axis.

Returns
the axis' index

◆ getValue()

float sofa::core::objectmodel::JoystickEvent::AxisEvent::getValue ( void  ) const

Retrieves the value of the axis.

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