arsa  2.7
Public Types | Public Member Functions | Public Attributes | List of all members
irr::SEvent::SJoystickEvent Struct Reference

A joystick event. More...

#include <IEventReceiver.h>

Public Types

enum  {
  NUMBER_OF_BUTTONS = 32, AXIS_X = 0, AXIS_Y, AXIS_Z,
  AXIS_R, AXIS_U, AXIS_V, NUMBER_OF_AXES =18
}
 

Public Member Functions

bool IsButtonPressed (u32 button) const
 A helper function to check if a button is pressed. More...
 

Public Attributes

u32 ButtonStates
 
s16 Axis [NUMBER_OF_AXES]
 
u16 POV
 
u8 Joystick
 The ID of the joystick which generated this event. More...
 

Detailed Description

A joystick event.

Unlike other events, joystick events represent the result of polling each connected joystick once per run() of the device. Joystick events will not be generated by default. If joystick support is available for the active device, IRR_COMPILE_WITH_JOYSTICK_EVENTS is defined, and irr::IrrlichtDevice::activateJoysticks() has been called, an event of this type will be generated once per joystick per IrrlichtDevice::run() regardless of whether the state of the joystick has actually changed.

Definition at line 482 of file IEventReceiver.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NUMBER_OF_BUTTONS 
AXIS_X 
AXIS_Y 
AXIS_Z 
AXIS_R 
AXIS_U 
AXIS_V 
NUMBER_OF_AXES 

Definition at line 484 of file IEventReceiver.h.

485  {
486  NUMBER_OF_BUTTONS = 32,
487 
488  AXIS_X = 0, // e.g. analog stick 1 left to right
489  AXIS_Y, // e.g. analog stick 1 top to bottom
490  AXIS_Z, // e.g. throttle, or analog 2 stick 2 left to right
491  AXIS_R, // e.g. rudder, or analog 2 stick 2 top to bottom
492  AXIS_U,
493  AXIS_V,
494  NUMBER_OF_AXES=18 // (please tell Irrlicht maintainers if you absolutely need more axes)
495  };

Member Function Documentation

◆ IsButtonPressed()

bool irr::SEvent::SJoystickEvent::IsButtonPressed ( u32  button) const
inline

A helper function to check if a button is pressed.

Definition at line 524 of file IEventReceiver.h.

525  {
526  if(button >= (u32)NUMBER_OF_BUTTONS)
527  return false;
528 
529  return (ButtonStates & (1 << button)) ? true : false;
530  }
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:62

Member Data Documentation

◆ Axis

s16 irr::SEvent::SJoystickEvent::Axis[NUMBER_OF_AXES]

For AXIS_X, AXIS_Y, AXIS_Z, AXIS_R, AXIS_U and AXIS_V Values are in the range -32768 to 32767, with 0 representing the center position. You will receive the raw value from the joystick, and so will usually want to implement a dead zone around the center of the range. Axes not supported by this joystick will always have a value of 0. On Linux, POV hats are represented as axes, usually the last two active axis.

Definition at line 509 of file IEventReceiver.h.

◆ ButtonStates

u32 irr::SEvent::SJoystickEvent::ButtonStates

A bitmap of button states. You can use IsButtonPressed() to ( check the state of each button from 0 to (NUMBER_OF_BUTTONS - 1)

Definition at line 499 of file IEventReceiver.h.

◆ Joystick

u8 irr::SEvent::SJoystickEvent::Joystick

The ID of the joystick which generated this event.

This is an internal Irrlicht index; it does not map directly to any particular hardware joystick.

Definition at line 521 of file IEventReceiver.h.

◆ POV

u16 irr::SEvent::SJoystickEvent::POV

The POV represents the angle of the POV hat in degrees * 100, from 0 to 35,900. A value of 65535 indicates that the POV hat is centered (or not present). This value is only supported on Windows. On Linux, the POV hat will be sent as 2 axes instead.

Definition at line 516 of file IEventReceiver.h.


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