com.threerings.opengl.gui.util
Class PseudoKeys

java.lang.Object
  extended by com.threerings.opengl.gui.util.PseudoKeys

public class PseudoKeys
extends Object

Provides a unified system for handling keys, mouse buttons, and other key-like features. The pseudo-keys are in the same identifier space as the key codes defined in Keyboard.


Nested Class Summary
static class PseudoKeys.Adapter
          For convenience, provides no-op implementations of the observer interface.
static interface PseudoKeys.Observer
          An interface for objects listening for key press and release events.
static class PseudoKeys.Unifier
          Processes unconsumed key, mouse, and controller events, converting them into unified "key" events.
 
Field Summary
static int KEY_BUTTON1
          A special "key" mapping for the left mouse button.
static int KEY_BUTTON2
          A special "key" mapping for the right mouse button.
static int KEY_BUTTON3
          A special "key" mapping for the middle mouse button.
static int KEY_BUTTON4
          A special "key" mapping for the 4th mouse button.
static int KEY_BUTTON5
          A special "key" mapping for the 5th mouse button.
static int KEY_CONTROLLER_AXIS_NEGATIVE
          A special "key" mapping for negative movement on a controller axis.
static int KEY_CONTROLLER_AXIS_POSITIVE
          A special "key" mapping for positive movement on a controller axis.
static int KEY_CONTROLLER_BUTTON
          A special "key" mapping for a controller button.
static int KEY_CONTROLLER_POV_X_NEGATIVE
          A special "key" mapping for negative movement on a controller pov x axis.
static int KEY_CONTROLLER_POV_X_POSITIVE
          A special "key" mapping for positive movement on a controller pov x axis.
static int KEY_CONTROLLER_POV_Y_NEGATIVE
          A special "key" mapping for negative movement on a controller pov y axis.
static int KEY_CONTROLLER_POV_Y_POSITIVE
          A special "key" mapping for positive movement on a controller pov y axis.
static int KEY_WHEEL_DOWN
          A special "key" mapping for scrolling the mouse wheel down.
static int KEY_WHEEL_UP
          A special "key" mapping for scrolling the mouse wheel up.
 
Constructor Summary
PseudoKeys()
           
 
Method Summary
static int getControlIndex(int key)
          Returns the control index.
static int getControllerIndex(int key)
          Returns the controller index.
static int getControllerKey(int type, int controllerIndex, int controlIndex)
          Returns the "key" mapping for the identified controller parameters.
static String getDesc(com.threerings.util.MessageBundle msgs, int key)
          Returns a string describing the specified key.
static int getMouseKey(int button)
          Returns the "key" mapping for the identified mouse button.
static String getName(int key)
          Returns the name for the specified key.
static int getType(int key)
          Returns the key type.
static boolean isValid(int key)
          Checks whether the supplied key is valid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_BUTTON1

public static final int KEY_BUTTON1
A special "key" mapping for the left mouse button.

See Also:
Constant Field Values

KEY_BUTTON2

public static final int KEY_BUTTON2
A special "key" mapping for the right mouse button.

See Also:
Constant Field Values

KEY_BUTTON3

public static final int KEY_BUTTON3
A special "key" mapping for the middle mouse button.

See Also:
Constant Field Values

KEY_WHEEL_UP

public static final int KEY_WHEEL_UP
A special "key" mapping for scrolling the mouse wheel up.

See Also:
Constant Field Values

KEY_WHEEL_DOWN

public static final int KEY_WHEEL_DOWN
A special "key" mapping for scrolling the mouse wheel down.

See Also:
Constant Field Values

KEY_CONTROLLER_BUTTON

public static final int KEY_CONTROLLER_BUTTON
A special "key" mapping for a controller button.

See Also:
Constant Field Values

KEY_CONTROLLER_AXIS_POSITIVE

public static final int KEY_CONTROLLER_AXIS_POSITIVE
A special "key" mapping for positive movement on a controller axis.

See Also:
Constant Field Values

KEY_CONTROLLER_AXIS_NEGATIVE

public static final int KEY_CONTROLLER_AXIS_NEGATIVE
A special "key" mapping for negative movement on a controller axis.

See Also:
Constant Field Values

KEY_CONTROLLER_POV_X_POSITIVE

public static final int KEY_CONTROLLER_POV_X_POSITIVE
A special "key" mapping for positive movement on a controller pov x axis.

See Also:
Constant Field Values

KEY_CONTROLLER_POV_X_NEGATIVE

public static final int KEY_CONTROLLER_POV_X_NEGATIVE
A special "key" mapping for negative movement on a controller pov x axis.

See Also:
Constant Field Values

KEY_CONTROLLER_POV_Y_POSITIVE

public static final int KEY_CONTROLLER_POV_Y_POSITIVE
A special "key" mapping for positive movement on a controller pov y axis.

See Also:
Constant Field Values

KEY_CONTROLLER_POV_Y_NEGATIVE

public static final int KEY_CONTROLLER_POV_Y_NEGATIVE
A special "key" mapping for negative movement on a controller pov y axis.

See Also:
Constant Field Values

KEY_BUTTON4

public static final int KEY_BUTTON4
A special "key" mapping for the 4th mouse button.

See Also:
Constant Field Values

KEY_BUTTON5

public static final int KEY_BUTTON5
A special "key" mapping for the 5th mouse button.

See Also:
Constant Field Values
Constructor Detail

PseudoKeys

public PseudoKeys()
Method Detail

getMouseKey

public static int getMouseKey(int button)
Returns the "key" mapping for the identified mouse button.


getControllerKey

public static int getControllerKey(int type,
                                   int controllerIndex,
                                   int controlIndex)
Returns the "key" mapping for the identified controller parameters.


isValid

public static boolean isValid(int key)
Checks whether the supplied key is valid. Controller keys are invalid if they refer to controllers or controls that don't exist.


getDesc

public static String getDesc(com.threerings.util.MessageBundle msgs,
                             int key)
Returns a string describing the specified key.


getName

public static String getName(int key)
Returns the name for the specified key.


getType

public static int getType(int key)
Returns the key type.


getControllerIndex

public static int getControllerIndex(int key)
Returns the controller index.


getControlIndex

public static int getControlIndex(int key)
Returns the control index.



Copyright © 2011. All Rights Reserved.