com.threerings.opengl.gui.event
Class ControllerEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.threerings.opengl.gui.event.Event
          extended by com.threerings.opengl.gui.event.InputEvent
              extended by com.threerings.opengl.gui.event.ControllerEvent
All Implemented Interfaces:
Serializable

public class ControllerEvent
extends InputEvent

Encapsulates the information associated with a controller (joystick, gamepad) event.

See Also:
Serialized Form

Field Summary
static int CONTROLLER_MOVED
          An event generated when the controller is moved on an axis.
static int CONTROLLER_POV_X_MOVED
          An event generated when the controller's pov is moved on the x axis.
static int CONTROLLER_POV_Y_MOVED
          An event generated when the controller's pov is moved on the y axis.
static int CONTROLLER_PRESSED
          An event generated when a controller button is pressed.
static int CONTROLLER_RELEASED
          An event generated when a controller button is released.
 
Fields inherited from class com.threerings.opengl.gui.event.InputEvent
ALT_DOWN_MASK, BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, CTRL_DOWN_MASK, META_DOWN_MASK, SHIFT_DOWN_MASK
 
Constructor Summary
ControllerEvent(org.lwjgl.input.Controller source, long when, int modifiers, int type, float value)
          Creates a new controller pov event.
ControllerEvent(org.lwjgl.input.Controller source, long when, int modifiers, int type, int controlIndex)
          Creates a new controller button event.
ControllerEvent(org.lwjgl.input.Controller source, long when, int modifiers, int type, int controlIndex, boolean xAxis, boolean yAxis, float value)
          Creates a new controller event.
 
Method Summary
 void dispatch(ComponentListener listener)
          Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.
 int getControlIndex()
          Returns the index of the control (button or axis) that caused the event, or -1 if not caused by a button or axis.
 org.lwjgl.input.Controller getController()
          Returns a reference to the controller that caused the event.
 int getType()
          Returns the type of this event, one of CONTROLLER_PRESSED, {#link CONTROLLER_RELEASED}, etc.
 float getValue()
          Returns the value corresponding to the event.
 boolean isXAxis()
          Checks whether the event pertains to the x axis.
 boolean isYAxis()
          Checks whether the event pertains to the y axis.
 
Methods inherited from class com.threerings.opengl.gui.event.InputEvent
getModifiers, isAltDown, isControlDown, isMetaDown, isShiftDown
 
Methods inherited from class com.threerings.opengl.gui.event.Event
consume, getWhen, isConsumed, propagateUpHierarchy, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTROLLER_PRESSED

public static final int CONTROLLER_PRESSED
An event generated when a controller button is pressed.

See Also:
Constant Field Values

CONTROLLER_RELEASED

public static final int CONTROLLER_RELEASED
An event generated when a controller button is released.

See Also:
Constant Field Values

CONTROLLER_MOVED

public static final int CONTROLLER_MOVED
An event generated when the controller is moved on an axis.

See Also:
Constant Field Values

CONTROLLER_POV_X_MOVED

public static final int CONTROLLER_POV_X_MOVED
An event generated when the controller's pov is moved on the x axis.

See Also:
Constant Field Values

CONTROLLER_POV_Y_MOVED

public static final int CONTROLLER_POV_Y_MOVED
An event generated when the controller's pov is moved on the y axis.

See Also:
Constant Field Values
Constructor Detail

ControllerEvent

public ControllerEvent(org.lwjgl.input.Controller source,
                       long when,
                       int modifiers,
                       int type,
                       int controlIndex)
Creates a new controller button event.


ControllerEvent

public ControllerEvent(org.lwjgl.input.Controller source,
                       long when,
                       int modifiers,
                       int type,
                       float value)
Creates a new controller pov event.


ControllerEvent

public ControllerEvent(org.lwjgl.input.Controller source,
                       long when,
                       int modifiers,
                       int type,
                       int controlIndex,
                       boolean xAxis,
                       boolean yAxis,
                       float value)
Creates a new controller event.

Method Detail

getController

public org.lwjgl.input.Controller getController()
Returns a reference to the controller that caused the event.


getType

public int getType()
Returns the type of this event, one of CONTROLLER_PRESSED, {#link CONTROLLER_RELEASED}, etc.


getControlIndex

public int getControlIndex()
Returns the index of the control (button or axis) that caused the event, or -1 if not caused by a button or axis.


isXAxis

public boolean isXAxis()
Checks whether the event pertains to the x axis.


isYAxis

public boolean isYAxis()
Checks whether the event pertains to the y axis.


getValue

public float getValue()
Returns the value corresponding to the event.


dispatch

public void dispatch(ComponentListener listener)
Description copied from class: Event
Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.

Overrides:
dispatch in class Event


Copyright © 2011. All Rights Reserved.