Public Types | Public Member Functions | Public Attributes

wit::JoystickEvent Class Reference

#include <wit/event.h>

List of all members.

Public Types

enum  Type {
  Joystick, Analog, Motion, Pointer,
  PointerLeave, ButtonPress, ButtonRelease, User = 256
}

Public Member Functions

 JoystickEvent (Controller ctype, unsigned short id, bool isRightStick=false)
void setByPosition (signed char px, signed char py)
void setByPosition (float px, float py)
void setByAngle (float pangle, float pmag)
int type () const

Public Attributes

bool isRightStick
float x
float y
float angle
float magnitude
Controller controllerType
unsigned short controllerNumber

Detailed Description

The JoystickEvent class describes the change in position of an analog joystick. Events are not generated if the stick is held in the same position. To reduce jitter and avoid generating excessive events, very small changes to the joystick position are ignored.

The following joystick devices are recognized:

Joystick events are only generated if the wit::UseJoysticks feature is set.

See also:
wit::EventHandler::joystickEvent()

Definition at line 48 of file event.h.


Member Enumeration Documentation

enum wit::Event::Type [inherited]
Enumerator:
Joystick 

The event was generated by changing the position of an analog joystick.

Analog 

The event was generated by changing the pressure on an analog button.

Motion 

The event was generated by the motion sensor of a Wii Remote or Nunchuk.

Pointer 

The event was generated by the infrared sensor of a Wii Remote.

PointerLeave 

The event was generated by the pointer moving out of a hotspot.

ButtonPress 

The event was generated by pressing a non-analog button or by fully depressing an analog button.

ButtonRelease 

The event was generated by releasing a non-analog button or by releasing a fully-depressed analog button,

User 

Base value for user-defined events.

Definition at line 12 of file event.h.


Constructor & Destructor Documentation

wit::JoystickEvent::JoystickEvent ( Controller  ctype,
unsigned short  id,
bool  isRightStick = false 
)

Constructs a joystick event with the specified type for the specified controller.

Set isRightStick to true for the right stick on the Classic Controller or for the C-stick for the GameCube controller.

Definition at line 154 of file event.cpp.


Member Function Documentation

void wit::JoystickEvent::setByAngle ( float  pangle,
float  pmag 
)

Initialize the event based on the angle counterclockwise measured from 0.0 degrees (right) to 360.0 and the magnitude measured from 0.0 (neutrally centered) to 1.0 (fully tilted).

Definition at line 193 of file event.cpp.

void wit::JoystickEvent::setByPosition ( float  px,
float  py 
)

Initialize the event based on horizontal and vertical positions measured from -1.0 to 1.0.

Definition at line 170 of file event.cpp.

void wit::JoystickEvent::setByPosition ( signed char  px,
signed char  py 
)

Initialize the event based on horizontal and vertical positions measured from -128 to 127.

Definition at line 162 of file event.cpp.

int wit::Event::type (  ) const [inherited]

Returns the type of the event.

Definition at line 30 of file event.cpp.


Member Data Documentation

Contains the angle toward which the stick is tilted, measured in degrees counterclockwise from right (0 degrees).

Definition at line 57 of file event.h.

unsigned short wit::InputEvent::controllerNumber [inherited]

Indicates which controller generated the event, generally numbered 0 to 3 for Wii Remotes and their accessories and numbered 4 to 7 for GameCube controllers.

Distinguishing between attached accessories can be done by reading the controllerType variable.

Definition at line 35 of file event.h.

Indicates which type of controller generated the event.

Definition at line 34 of file event.h.

Set to true if the event was generated by the right analog stick on the Classic Controller or by the C-stick on a GameCube controller.

Definition at line 56 of file event.h.

Contains the amount the stick is tilted, between 0.0 (neutrally centered) and 1.0 (fully tilted).

Definition at line 57 of file event.h.

Contains the current horizontal position of the stick between -1.0 (left) and 1.0 (right).

Definition at line 57 of file event.h.

Contains the current vertical position of the stick between -1.0 (up) and 1.0 (down).

Definition at line 57 of file event.h.


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