FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::JoystickEvent Class Reference

Class for Joystick events. More...

#include <joystickevent.h>

+ Inheritance diagram for FIFE::JoystickEvent:
+ Collaboration diagram for FIFE::JoystickEvent:

Public Types

enum  JoystickEventType {
  UNKNOWN_EVENT = 0, AXIS_MOTION, HAT_MOTION, BUTTON_PRESSED,
  BUTTON_RELEASED, DEVICE_ADDED, DEVICE_REMOVED
}
 

Public Member Functions

 JoystickEvent ()
 Constructor. More...
 
virtual ~JoystickEvent ()
 Destructor. More...
 
JoystickEventType getType () const
 Return the event type. More...
 
void setType (JoystickEventType type)
 Sets the event type. More...
 
int32_t getInstanceId () const
 Return the instance id of the joystick. More...
 
void setInstanceId (int32_t id)
 Sets the instance id of the joystick. More...
 
int8_t getAxis () const
 Return the index number of axis for joystick, or the Joystick::ContollerAxis for controller. More...
 
void setAxis (int8_t axis)
 Sets the axis index number or the Joystick::ControllerAxis. More...
 
float getAxisValue () const
 Return the axis value, range is -1.0 to 1.0. More...
 
void setAxisValue (float value)
 Sets the axis value. More...
 
int8_t getHat () const
 Return the hat index. More...
 
void setHat (int8_t hat)
 Sets the hat index. More...
 
int8_t getHatValue () const
 Return the hat value, see Joystick::Hat. More...
 
void setHatValue (int8_t value)
 Sets the hat value. More...
 
int8_t getButton () const
 Return the button index for joystick, or Joystick::ControllerButton for controller. More...
 
void setButton (int8_t button)
 Sets the button index or Joystick::ControllerButton. More...
 
bool isController () const
 Return true if it is a controller, false if only a joystick. More...
 
void setController (bool value)
 Sets to true if the event is for a controller, otherwise false. More...
 
virtual void consume ()
 Marks events as consumed. More...
 
virtual bool isConsumed () const
 Checks whether event is consumed. More...
 
virtual void consumedByWidgets ()
 Marks events as consumed by widget library. More...
 
virtual bool isConsumedByWidgets () const
 Checks whether event is consumed by widget library. More...
 
virtual IEventSourcegetSource () const
 Gets the source of the event. More...
 
virtual void setSource (IEventSource *source)
 Sets the source of the event. More...
 
virtual int32_t getTimeStamp () const
 Gets the timestamp of the event. More...
 
virtual void setTimeStamp (int32_t timestamp)
 Sets the timestamp of the event. More...
 
virtual const std::string & getName () const
 Gets the name of the event. More...
 
virtual std::string getDebugString () const
 Gets the debugstring of the event. More...
 
- Public Member Functions inherited from FIFE::InputEvent
 InputEvent ()
 Constructor. More...
 
 ~InputEvent ()
 Destructor. More...
 
virtual bool isAltPressed () const
 Checks whether alt is pressed. More...
 
virtual void setAltPressed (bool pressed)
 Sets alt to pressed. More...
 
virtual bool isControlPressed () const
 Checks whether control is pressed. More...
 
virtual void setControlPressed (bool pressed)
 Sets control to pressed. More...
 
virtual bool isMetaPressed () const
 Checks whether meta is pressed. More...
 
virtual void setMetaPressed (bool pressed)
 Sets meta to pressed. More...
 
virtual bool isShiftPressed () const
 Checks whether shift is pressed. More...
 
virtual void setShiftPressed (bool pressed)
 Sets shift to pressed. More...
 
virtual std::string getAttrStr () const
 Gets attribute string of the event. More...
 
- Public Member Functions inherited from FIFE::Event
 Event ()
 Constructor. More...
 
virtual ~Event ()
 Destructor. More...
 

Private Attributes

JoystickEventType m_eventType
 Event type. More...
 
int32_t m_instanceId
 Joystick instance id. More...
 
int8_t m_axis
 Axis index. More...
 
float m_axisValue
 Axis value. More...
 
int8_t m_hat
 Hat index. More...
 
int8_t m_hatValue
 Hat value. More...
 
int8_t m_button
 Button index. More...
 
bool m_controller
 Is gamecontroller. More...
 

Detailed Description

Class for Joystick events.

Definition at line 45 of file joystickevent.h.

Member Enumeration Documentation

◆ JoystickEventType

Enumerator
UNKNOWN_EVENT 
AXIS_MOTION 
HAT_MOTION 
BUTTON_PRESSED 
BUTTON_RELEASED 
DEVICE_ADDED 
DEVICE_REMOVED 

Definition at line 47 of file joystickevent.h.

Constructor & Destructor Documentation

◆ JoystickEvent()

FIFE::JoystickEvent::JoystickEvent ( )
inline

Constructor.

Definition at line 59 of file joystickevent.h.

◆ ~JoystickEvent()

virtual FIFE::JoystickEvent::~JoystickEvent ( )
inlinevirtual

Destructor.

Definition at line 72 of file joystickevent.h.

Member Function Documentation

◆ consume()

virtual void FIFE::JoystickEvent::consume ( )
inlinevirtual

Marks events as consumed.

Reimplemented from FIFE::InputEvent.

Definition at line 138 of file joystickevent.h.

References FIFE::InputEvent::consume().

◆ consumedByWidgets()

virtual void FIFE::JoystickEvent::consumedByWidgets ( )
inlinevirtual

Marks events as consumed by widget library.

Reimplemented from FIFE::InputEvent.

Definition at line 140 of file joystickevent.h.

References FIFE::InputEvent::consumedByWidgets().

◆ getAxis()

int8_t FIFE::JoystickEvent::getAxis ( ) const
inline

Return the index number of axis for joystick, or the Joystick::ContollerAxis for controller.

Definition at line 92 of file joystickevent.h.

References m_axis.

◆ getAxisValue()

float FIFE::JoystickEvent::getAxisValue ( ) const
inline

Return the axis value, range is -1.0 to 1.0.

Definition at line 100 of file joystickevent.h.

References m_axisValue.

◆ getButton()

int8_t FIFE::JoystickEvent::getButton ( ) const
inline

Return the button index for joystick, or Joystick::ControllerButton for controller.

Definition at line 124 of file joystickevent.h.

References m_button.

◆ getDebugString()

virtual std::string FIFE::JoystickEvent::getDebugString ( ) const
inlinevirtual

Gets the debugstring of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 151 of file joystickevent.h.

References FIFE::InputEvent::getDebugString().

◆ getHat()

int8_t FIFE::JoystickEvent::getHat ( ) const
inline

Return the hat index.

Definition at line 108 of file joystickevent.h.

References m_hat.

◆ getHatValue()

int8_t FIFE::JoystickEvent::getHatValue ( ) const
inline

Return the hat value, see Joystick::Hat.

Definition at line 116 of file joystickevent.h.

References m_hatValue.

◆ getInstanceId()

int32_t FIFE::JoystickEvent::getInstanceId ( ) const
inline

Return the instance id of the joystick.

Definition at line 84 of file joystickevent.h.

References m_instanceId.

Referenced by FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ getName()

virtual const std::string& FIFE::JoystickEvent::getName ( ) const
inlinevirtual

Gets the name of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 147 of file joystickevent.h.

◆ getSource()

virtual IEventSource* FIFE::JoystickEvent::getSource ( ) const
inlinevirtual

Gets the source of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 142 of file joystickevent.h.

References FIFE::InputEvent::getSource().

◆ getTimeStamp()

virtual int32_t FIFE::JoystickEvent::getTimeStamp ( ) const
inlinevirtual

Gets the timestamp of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 144 of file joystickevent.h.

References FIFE::InputEvent::getTimeStamp().

◆ getType()

JoystickEventType FIFE::JoystickEvent::getType ( ) const
inline

Return the event type.

Definition at line 76 of file joystickevent.h.

References m_eventType.

Referenced by FIFE::JoystickManager::dispatchJoystickEvent().

+ Here is the caller graph for this function:

◆ isConsumed()

virtual bool FIFE::JoystickEvent::isConsumed ( ) const
inlinevirtual

Checks whether event is consumed.

Reimplemented from FIFE::InputEvent.

Definition at line 139 of file joystickevent.h.

References FIFE::InputEvent::isConsumed().

Referenced by FIFE::JoystickManager::dispatchJoystickEvent().

+ Here is the caller graph for this function:

◆ isConsumedByWidgets()

virtual bool FIFE::JoystickEvent::isConsumedByWidgets ( ) const
inlinevirtual

Checks whether event is consumed by widget library.

Reimplemented from FIFE::InputEvent.

Definition at line 141 of file joystickevent.h.

References FIFE::InputEvent::isConsumedByWidgets().

◆ isController()

bool FIFE::JoystickEvent::isController ( ) const
inline

Return true if it is a controller, false if only a joystick.

Definition at line 132 of file joystickevent.h.

References m_controller.

◆ setAxis()

void FIFE::JoystickEvent::setAxis ( int8_t  axis)
inline

Sets the axis index number or the Joystick::ControllerAxis.

Definition at line 96 of file joystickevent.h.

References m_axis.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setAxisValue()

void FIFE::JoystickEvent::setAxisValue ( float  value)
inline

Sets the axis value.

Definition at line 104 of file joystickevent.h.

References m_axisValue.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setButton()

void FIFE::JoystickEvent::setButton ( int8_t  button)
inline

Sets the button index or Joystick::ControllerButton.

Definition at line 128 of file joystickevent.h.

References m_button.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setController()

void FIFE::JoystickEvent::setController ( bool  value)
inline

Sets to true if the event is for a controller, otherwise false.

Definition at line 136 of file joystickevent.h.

References m_controller.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setHat()

void FIFE::JoystickEvent::setHat ( int8_t  hat)
inline

Sets the hat index.

Definition at line 112 of file joystickevent.h.

References m_hat.

Referenced by FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setHatValue()

void FIFE::JoystickEvent::setHatValue ( int8_t  value)
inline

Sets the hat value.

Definition at line 120 of file joystickevent.h.

References m_hatValue.

Referenced by FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setInstanceId()

void FIFE::JoystickEvent::setInstanceId ( int32_t  id)
inline

Sets the instance id of the joystick.

Definition at line 88 of file joystickevent.h.

References m_instanceId.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setSource()

virtual void FIFE::JoystickEvent::setSource ( IEventSource source)
inlinevirtual

Sets the source of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 143 of file joystickevent.h.

References FIFE::InputEvent::setSource().

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

◆ setTimeStamp()

virtual void FIFE::JoystickEvent::setTimeStamp ( int32_t  timestamp)
inlinevirtual

Sets the timestamp of the event.

Reimplemented from FIFE::InputEvent.

Definition at line 145 of file joystickevent.h.

References FIFE::InputEvent::setTimeStamp().

◆ setType()

void FIFE::JoystickEvent::setType ( JoystickEventType  type)
inline

Sets the event type.

Definition at line 80 of file joystickevent.h.

References m_eventType.

Referenced by FIFE::JoystickManager::processControllerEvent(), and FIFE::JoystickManager::processJoystickEvent().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_axis

int8_t FIFE::JoystickEvent::m_axis
private

Axis index.

Definition at line 159 of file joystickevent.h.

Referenced by getAxis(), and setAxis().

◆ m_axisValue

float FIFE::JoystickEvent::m_axisValue
private

Axis value.

Definition at line 161 of file joystickevent.h.

Referenced by getAxisValue(), and setAxisValue().

◆ m_button

int8_t FIFE::JoystickEvent::m_button
private

Button index.

Definition at line 167 of file joystickevent.h.

Referenced by getButton(), and setButton().

◆ m_controller

bool FIFE::JoystickEvent::m_controller
private

Is gamecontroller.

Definition at line 169 of file joystickevent.h.

Referenced by isController(), and setController().

◆ m_eventType

JoystickEventType FIFE::JoystickEvent::m_eventType
private

Event type.

Definition at line 155 of file joystickevent.h.

Referenced by getType(), and setType().

◆ m_hat

int8_t FIFE::JoystickEvent::m_hat
private

Hat index.

Definition at line 163 of file joystickevent.h.

Referenced by getHat(), and setHat().

◆ m_hatValue

int8_t FIFE::JoystickEvent::m_hatValue
private

Hat value.

Definition at line 165 of file joystickevent.h.

Referenced by getHatValue(), and setHatValue().

◆ m_instanceId

int32_t FIFE::JoystickEvent::m_instanceId
private

Joystick instance id.

Definition at line 157 of file joystickevent.h.

Referenced by getInstanceId(), and setInstanceId().


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