AntiMicroX
Public Types | Public Slots | Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
JoyAxis Class Reference

Represents single axis of of joystick (or other input) More...

#include <joyaxis.h>

Inheritance diagram for JoyAxis:
[legend]
Collaboration diagram for JoyAxis:
[legend]

Public Types

enum  ThrottleTypes {
  NegativeHalfThrottle = -2, NegativeThrottle = -1, NormalThrottle = 0, PositiveThrottle = 1,
  PositiveHalfThrottle = 2
}
 

Public Slots

virtual void reset ()
 
virtual void reset (int index)
 
void propogateThrottleChange ()
 
void setDeadZone (int value)
 
void setMaxZoneValue (int value)
 
void setAxisName (QString tempName)
 
void setButtonsSpringRelativeStatus (bool value)
 
void setButtonsEasingDuration (double value)
 
void establishPropertyUpdatedConnection ()
 
void disconnectPropertyUpdatedConnection ()
 

Signals

void active (int value)
 
void released (int value)
 
void moved (int value)
 
void throttleChangePropogated (int index)
 
void throttleChanged ()
 
void axisNameChanged ()
 
void propertyUpdated ()
 
void hapticTriggerChanged ()
 

Public Member Functions

 JoyAxis (int index, int originset, SetJoystick *parentSet, QObject *parent)
 
virtual ~JoyAxis ()
 
void joyEvent (int value, bool ignoresets=false, bool updateLastValues=true)
 
void queuePendingEvent (int value, bool ignoresets=false, bool updateLastValues=true)
 
void activatePendingEvent ()
 
bool hasPendingEvent ()
 
void clearPendingEvent ()
 
bool inDeadZone (int value)
 
virtual QString getName (bool forceFullFormat=false, bool displayNames=false)
 
virtual QString getPartialName (bool forceFullFormat=false, bool displayNames=false)
 
virtual QString getXmlName ()
 
void setIndex (int index)
 
int getIndex ()
 
int getRealJoyIndex ()
 
JoyAxisButtongetPAxisButton ()
 
JoyAxisButtongetNAxisButton ()
 
int getDeadZone ()
 
int getMaxZoneValue ()
 
void setThrottle (int value)
 Set throttle value for axis. More...
 
void setInitialThrottle (int value)
 Set the initial calibrated throttle based on the first event passed by SDL. More...
 
void updateCurrentThrottledValue (int newValue)
 
int getThrottle ()
 
int getCurrentThrottledValue ()
 
int getCurrentRawValue ()
 
int getCurrentThrottledDeadValue ()
 
int getCurrentlyAssignedSet ()
 
JoyAxisButtongetAxisButtonByValue (int value)
 
double getDistanceFromDeadZone ()
 
double getDistanceFromDeadZone (int value)
 
double getRawDistance (int value)
 Get the current value for an axis in either direction converted to the range of -1.0 to 1.0. More...
 
void setControlStick (JoyControlStick *stick)
 
void removeControlStick (bool performRelease=true)
 
bool isPartControlStick ()
 
JoyControlStickgetControlStick ()
 
bool hasControlOfButtons ()
 
void removeVDPads ()
 
void setButtonsMouseMode (JoyButton::JoyMouseMovementMode mode)
 
bool hasSameButtonsMouseMode ()
 
JoyButton::JoyMouseMovementMode getButtonsPresetMouseMode ()
 
void setButtonsMouseCurve (JoyButton::JoyMouseCurve mouseCurve)
 
bool hasSameButtonsMouseCurve ()
 
JoyButton::JoyMouseCurve getButtonsPresetMouseCurve ()
 
void setButtonsSpringWidth (int value)
 
int getButtonsPresetSpringWidth ()
 
void setButtonsSpringHeight (int value)
 
int getButtonsPresetSpringHeight ()
 
void setButtonsSensitivity (double value)
 
double getButtonsPresetSensitivity ()
 
void setButtonsWheelSpeedX (int value)
 
void setButtonsWheelSpeedY (int value)
 
double getButtonsEasingDuration ()
 
bool isCalibrated () const
 Check if the axis is calibrated. More...
 
void resetCalibration ()
 Resets the axis calibration back to uncalibrated state. More...
 
void getCalibration (double *offset, double *gain) const
 Reads the axis calibration values. More...
 
void setCalibration (double offset, double gain)
 Sets the axis calibration values and sets the calibration flag. Calibrated value is calculated by the formula "a+b*x". More...
 
virtual QString getAxisName ()
 
virtual int getDefaultDeadZone ()
 
virtual int getDefaultMaxZone ()
 
virtual ThrottleTypes getDefaultThrottle ()
 
virtual void setDefaultAxisName (QString tempname)
 
virtual QString getDefaultAxisName ()
 
SetJoystickgetParentSet ()
 
virtual bool isDefault ()
 
bool isRelativeSpring ()
 
void copyAssignments (JoyAxis *destAxis)
 
int getLastKnownThrottleValue ()
 
int getLastKnownRawValue ()
 
int getProperReleaseValue ()
 Determine an appropriate release value for an axis depending on the current throttle setting being used. More...
 
void setCurrentRawValue (int value)
 
void copyRawValues (JoyAxis *srcAxis)
 
void copyThrottledValues (JoyAxis *srcAxis)
 
void setExtraAccelerationCurve (JoyButton::JoyExtraAccelerationCurve curve)
 
JoyButton::JoyExtraAccelerationCurve getExtraAccelerationCurve ()
 
virtual void eventReset ()
 
int calculateThrottledValue (int value)
 
virtual bool hasHapticTrigger () const
 Checks if the axis supports haptic trigger feedback. More...
 
virtual HapticTriggerPs5getHapticTrigger () const
 Always returns nullptr for JoyAxis base objects. More...
 
virtual void setHapticTriggerMode (HapticTriggerModePs5)
 Changes the haptic trigger effect mode. More...
 

Static Public Attributes

static const ThrottleTypes DEFAULTTHROTTLE = JoyAxis::NormalThrottle
 

Protected Member Functions

void createDeskEvent (bool ignoresets=false)
 
void adjustRange ()
 
void performCalibration (int value)
 
void stickPassEvent (int value, bool ignoresets=false, bool updateLastValues=true)
 

Protected Attributes

JoyAxisButtonpaxisbutton
 
JoyAxisButtonnaxisbutton
 
QString axisName
 
QString defaultAxisName
 
int throttle
 
int deadZone
 
int maxZoneValue
 
int currentRawValue
 
int currentThrottledValue
 
int currentThrottledDeadValue
 
int m_index
 
int lastKnownThottledValue
 
int lastKnownRawValue
 
int pendingValue
 
bool isActive
 
bool pendingEvent
 
bool pendingIgnoreSets
 
bool eventActive
 
JoyAxisButtonactiveButton
 

Private Member Functions

void resetPrivateVars ()
 

Private Attributes

int m_originset
 
JoyControlStickm_stick
 
SetJoystickm_parentSet
 
bool m_calibrated
 
double m_offset
 
double m_gain
 

Detailed Description

Represents single axis of of joystick (or other input)

Member Enumeration Documentation

◆ ThrottleTypes

Enumerator
NegativeHalfThrottle 
NegativeThrottle 
NormalThrottle 
PositiveThrottle 
PositiveHalfThrottle 

Constructor & Destructor Documentation

◆ JoyAxis()

JoyAxis::JoyAxis ( int  index,
int  originset,
SetJoystick parentSet,
QObject *  parent 
)
explicit
Here is the call graph for this function:

◆ ~JoyAxis()

JoyAxis::~JoyAxis ( )
virtual
Here is the call graph for this function:

Member Function Documentation

◆ activatePendingEvent()

void JoyAxis::activatePendingEvent ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ active

void JoyAxis::active ( int  value)
signal
Here is the caller graph for this function:

◆ adjustRange()

void JoyAxis::adjustRange ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ axisNameChanged

void JoyAxis::axisNameChanged ( )
signal
Here is the caller graph for this function:

◆ calculateThrottledValue()

int JoyAxis::calculateThrottledValue ( int  value)
Here is the caller graph for this function:

◆ clearPendingEvent()

void JoyAxis::clearPendingEvent ( )
Here is the caller graph for this function:

◆ copyAssignments()

void JoyAxis::copyAssignments ( JoyAxis destAxis)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyRawValues()

void JoyAxis::copyRawValues ( JoyAxis srcAxis)
Here is the caller graph for this function:

◆ copyThrottledValues()

void JoyAxis::copyThrottledValues ( JoyAxis srcAxis)
Here is the caller graph for this function:

◆ createDeskEvent()

void JoyAxis::createDeskEvent ( bool  ignoresets = false)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ disconnectPropertyUpdatedConnection

void JoyAxis::disconnectPropertyUpdatedConnection ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ establishPropertyUpdatedConnection

void JoyAxis::establishPropertyUpdatedConnection ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventReset()

void JoyAxis::eventReset ( )
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAxisButtonByValue()

JoyAxisButton * JoyAxis::getAxisButtonByValue ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAxisName()

QString JoyAxis::getAxisName ( )
virtual
Here is the caller graph for this function:

◆ getButtonsEasingDuration()

double JoyAxis::getButtonsEasingDuration ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getButtonsPresetMouseCurve()

JoyButton::JoyMouseCurve JoyAxis::getButtonsPresetMouseCurve ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getButtonsPresetMouseMode()

JoyButton::JoyMouseMovementMode JoyAxis::getButtonsPresetMouseMode ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getButtonsPresetSensitivity()

double JoyAxis::getButtonsPresetSensitivity ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getButtonsPresetSpringHeight()

int JoyAxis::getButtonsPresetSpringHeight ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getButtonsPresetSpringWidth()

int JoyAxis::getButtonsPresetSpringWidth ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCalibration()

void JoyAxis::getCalibration ( double *  offset,
double *  gain 
) const

Reads the axis calibration values.

Parameters
[out]offsetOffset value "a"
[out]gainGain value "b"

◆ getControlStick()

JoyControlStick * JoyAxis::getControlStick ( )

◆ getCurrentlyAssignedSet()

int JoyAxis::getCurrentlyAssignedSet ( )
Here is the caller graph for this function:

◆ getCurrentRawValue()

int JoyAxis::getCurrentRawValue ( )
Here is the caller graph for this function:

◆ getCurrentThrottledDeadValue()

int JoyAxis::getCurrentThrottledDeadValue ( )
Here is the caller graph for this function:

◆ getCurrentThrottledValue()

int JoyAxis::getCurrentThrottledValue ( )
Here is the caller graph for this function:

◆ getDeadZone()

int JoyAxis::getDeadZone ( )
Here is the caller graph for this function:

◆ getDefaultAxisName()

QString JoyAxis::getDefaultAxisName ( )
virtual

◆ getDefaultDeadZone()

int JoyAxis::getDefaultDeadZone ( )
virtual

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ getDefaultMaxZone()

int JoyAxis::getDefaultMaxZone ( )
virtual

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ getDefaultThrottle()

JoyAxis::ThrottleTypes JoyAxis::getDefaultThrottle ( )
virtual

Reimplemented in GameControllerTrigger.

◆ getDistanceFromDeadZone() [1/2]

double JoyAxis::getDistanceFromDeadZone ( )
Here is the caller graph for this function:

◆ getDistanceFromDeadZone() [2/2]

double JoyAxis::getDistanceFromDeadZone ( int  value)

◆ getExtraAccelerationCurve()

JoyButton::JoyExtraAccelerationCurve JoyAxis::getExtraAccelerationCurve ( )
Here is the call graph for this function:

◆ getHapticTrigger()

HapticTriggerPs5 * JoyAxis::getHapticTrigger ( ) const
virtual

Always returns nullptr for JoyAxis base objects.

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ getIndex()

int JoyAxis::getIndex ( )
Here is the caller graph for this function:

◆ getLastKnownRawValue()

int JoyAxis::getLastKnownRawValue ( )

◆ getLastKnownThrottleValue()

int JoyAxis::getLastKnownThrottleValue ( )
Here is the caller graph for this function:

◆ getMaxZoneValue()

int JoyAxis::getMaxZoneValue ( )
Here is the caller graph for this function:

◆ getName()

QString JoyAxis::getName ( bool  forceFullFormat = false,
bool  displayNames = false 
)
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNAxisButton()

JoyAxisButton * JoyAxis::getNAxisButton ( )

◆ getParentSet()

SetJoystick * JoyAxis::getParentSet ( )
Here is the caller graph for this function:

◆ getPartialName()

QString JoyAxis::getPartialName ( bool  forceFullFormat = false,
bool  displayNames = false 
)
virtual

Reimplemented in GameControllerTrigger.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPAxisButton()

JoyAxisButton * JoyAxis::getPAxisButton ( )

◆ getProperReleaseValue()

int JoyAxis::getProperReleaseValue ( )

Determine an appropriate release value for an axis depending on the current throttle setting being used.

Returns
Release value for an axis
Here is the caller graph for this function:

◆ getRawDistance()

double JoyAxis::getRawDistance ( int  value)

Get the current value for an axis in either direction converted to the range of -1.0 to 1.0.

Parameters
Currentinterger value of the axis
Returns
Axis value in the range of -1.0 to 1.0
Here is the caller graph for this function:

◆ getRealJoyIndex()

int JoyAxis::getRealJoyIndex ( )
Here is the caller graph for this function:

◆ getThrottle()

int JoyAxis::getThrottle ( )
Here is the caller graph for this function:

◆ getXmlName()

QString JoyAxis::getXmlName ( )
virtual

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ hapticTriggerChanged

void JoyAxis::hapticTriggerChanged ( )
signal
Here is the caller graph for this function:

◆ hasControlOfButtons()

bool JoyAxis::hasControlOfButtons ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasHapticTrigger()

bool JoyAxis::hasHapticTrigger ( ) const
virtual

Checks if the axis supports haptic trigger feedback.

Returns
True if the axis supports haptic trigger feedback, false otherwise.

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ hasPendingEvent()

bool JoyAxis::hasPendingEvent ( )
Here is the caller graph for this function:

◆ hasSameButtonsMouseCurve()

bool JoyAxis::hasSameButtonsMouseCurve ( )
Here is the call graph for this function:

◆ hasSameButtonsMouseMode()

bool JoyAxis::hasSameButtonsMouseMode ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ inDeadZone()

bool JoyAxis::inDeadZone ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCalibrated()

bool JoyAxis::isCalibrated ( ) const

Check if the axis is calibrated.

Returns
True if the axis is calibrated, false otherwise.

◆ isDefault()

bool JoyAxis::isDefault ( )
virtual
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPartControlStick()

bool JoyAxis::isPartControlStick ( )
Here is the caller graph for this function:

◆ isRelativeSpring()

bool JoyAxis::isRelativeSpring ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ joyEvent()

void JoyAxis::joyEvent ( int  value,
bool  ignoresets = false,
bool  updateLastValues = true 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ moved

void JoyAxis::moved ( int  value)
signal
Here is the caller graph for this function:

◆ performCalibration()

void JoyAxis::performCalibration ( int  value)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyUpdated

void JoyAxis::propertyUpdated ( )
signal
Here is the caller graph for this function:

◆ propogateThrottleChange

void JoyAxis::propogateThrottleChange ( )
slot
Here is the caller graph for this function:

◆ queuePendingEvent()

void JoyAxis::queuePendingEvent ( int  value,
bool  ignoresets = false,
bool  updateLastValues = true 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ released

void JoyAxis::released ( int  value)
signal
Here is the caller graph for this function:

◆ removeControlStick()

void JoyAxis::removeControlStick ( bool  performRelease = true)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeVDPads()

void JoyAxis::removeVDPads ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset [1/2]

void JoyAxis::reset ( )
virtualslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset [2/2]

void JoyAxis::reset ( int  index)
virtualslot
Here is the call graph for this function:

◆ resetCalibration()

void JoyAxis::resetCalibration ( )

Resets the axis calibration back to uncalibrated state.

◆ resetPrivateVars()

void JoyAxis::resetPrivateVars ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAxisName

void JoyAxis::setAxisName ( QString  tempName)
slot
Here is the caller graph for this function:

◆ setButtonsEasingDuration

void JoyAxis::setButtonsEasingDuration ( double  value)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsMouseCurve()

void JoyAxis::setButtonsMouseCurve ( JoyButton::JoyMouseCurve  mouseCurve)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsMouseMode()

void JoyAxis::setButtonsMouseMode ( JoyButton::JoyMouseMovementMode  mode)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsSensitivity()

void JoyAxis::setButtonsSensitivity ( double  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsSpringHeight()

void JoyAxis::setButtonsSpringHeight ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsSpringRelativeStatus

void JoyAxis::setButtonsSpringRelativeStatus ( bool  value)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsSpringWidth()

void JoyAxis::setButtonsSpringWidth ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsWheelSpeedX()

void JoyAxis::setButtonsWheelSpeedX ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setButtonsWheelSpeedY()

void JoyAxis::setButtonsWheelSpeedY ( int  value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCalibration()

void JoyAxis::setCalibration ( double  offset,
double  gain 
)

Sets the axis calibration values and sets the calibration flag. Calibrated value is calculated by the formula "a+b*x".

◆ setControlStick()

void JoyAxis::setControlStick ( JoyControlStick stick)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentRawValue()

void JoyAxis::setCurrentRawValue ( int  value)
Here is the caller graph for this function:

◆ setDeadZone

void JoyAxis::setDeadZone ( int  value)
slot
Here is the caller graph for this function:

◆ setDefaultAxisName()

void JoyAxis::setDefaultAxisName ( QString  tempname)
virtual
Here is the caller graph for this function:

◆ setExtraAccelerationCurve()

void JoyAxis::setExtraAccelerationCurve ( JoyButton::JoyExtraAccelerationCurve  curve)
Here is the call graph for this function:

◆ setHapticTriggerMode()

void JoyAxis::setHapticTriggerMode ( HapticTriggerModePs5  )
virtual

Changes the haptic trigger effect mode.

Parameters
[in]modeNew haptic trigger effect mode.

Reimplemented in GameControllerTrigger.

Here is the caller graph for this function:

◆ setIndex()

void JoyAxis::setIndex ( int  index)

◆ setInitialThrottle()

void JoyAxis::setInitialThrottle ( int  value)

Set the initial calibrated throttle based on the first event passed by SDL.

Parameters
Currentvalue for axis.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMaxZoneValue

void JoyAxis::setMaxZoneValue ( int  value)
slot
Here is the caller graph for this function:

◆ setThrottle()

void JoyAxis::setThrottle ( int  value)

Set throttle value for axis.

Parameters
Currentvalue for axis.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stickPassEvent()

void JoyAxis::stickPassEvent ( int  value,
bool  ignoresets = false,
bool  updateLastValues = true 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ throttleChanged

void JoyAxis::throttleChanged ( )
signal
Here is the caller graph for this function:

◆ throttleChangePropogated

void JoyAxis::throttleChangePropogated ( int  index)
signal
Here is the caller graph for this function:

◆ updateCurrentThrottledValue()

void JoyAxis::updateCurrentThrottledValue ( int  newValue)
Here is the caller graph for this function:

Field Documentation

◆ activeButton

JoyAxisButton* JoyAxis::activeButton
protected

◆ axisName

QString JoyAxis::axisName
protected

◆ currentRawValue

int JoyAxis::currentRawValue
protected

◆ currentThrottledDeadValue

int JoyAxis::currentThrottledDeadValue
protected

◆ currentThrottledValue

int JoyAxis::currentThrottledValue
protected

◆ deadZone

int JoyAxis::deadZone
protected

◆ defaultAxisName

QString JoyAxis::defaultAxisName
protected

◆ DEFAULTTHROTTLE

const JoyAxis::ThrottleTypes JoyAxis::DEFAULTTHROTTLE = JoyAxis::NormalThrottle
static

◆ eventActive

bool JoyAxis::eventActive
protected

◆ isActive

bool JoyAxis::isActive
protected

◆ lastKnownRawValue

int JoyAxis::lastKnownRawValue
protected

◆ lastKnownThottledValue

int JoyAxis::lastKnownThottledValue
protected

◆ m_calibrated

bool JoyAxis::m_calibrated
private

◆ m_gain

double JoyAxis::m_gain
private

◆ m_index

int JoyAxis::m_index
protected

◆ m_offset

double JoyAxis::m_offset
private

◆ m_originset

int JoyAxis::m_originset
private

◆ m_parentSet

SetJoystick* JoyAxis::m_parentSet
private

◆ m_stick

JoyControlStick* JoyAxis::m_stick
private

◆ maxZoneValue

int JoyAxis::maxZoneValue
protected

◆ naxisbutton

JoyAxisButton* JoyAxis::naxisbutton
protected

◆ paxisbutton

JoyAxisButton* JoyAxis::paxisbutton
protected

◆ pendingEvent

bool JoyAxis::pendingEvent
protected

◆ pendingIgnoreSets

bool JoyAxis::pendingIgnoreSets
protected

◆ pendingValue

int JoyAxis::pendingValue
protected

◆ throttle

int JoyAxis::throttle
protected

The documentation for this class was generated from the following files: