Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## tv.ouya.console.api
Class OuyaController

    java.lang.Object
      tv.ouya.console.api.OuyaController

    public class OuyaController

extends java.lang.Object

Utility class that contains codes for console buttons and axes.

Field Summary
`static int` | `AXIS_L2` Code for the left trigger axis.
`static int` | `AXIS_LS_X` Code for the left joystick x axis.
`static int` | `AXIS_LS_Y` Code for the left joystick y axis.
`static int` | `AXIS_R2` Code for the right trigger axis.
`static int` | `AXIS_RS_X` Code for the right joystick x axis.
`static int` | `AXIS_RS_Y` Code for the right joystick y axis.
`static int` | `BUTTON_A` Code for the A button.
`static int` | `BUTTON_DPAD_DOWN` Code for the D-pad down button.
`static int` | `BUTTON_DPAD_LEFT` Code for the D-pad left button.
`static int` | `BUTTON_DPAD_RIGHT` Code for the D-pad right button.
`static int` | `BUTTON_DPAD_UP` Code for the D-pad up button.
`static int` | `BUTTON_L1` Code for the left bumper button.
`static int` | `BUTTON_L2` Deprecated. This code is unreliable on some controller firmwares. Use of analog axis value is recommended.
`static int` | `BUTTON_L3` Code for left joystick button.
`static int` | `BUTTON_MENU` Code for a short press of the system button.
`static int` | `BUTTON_O` Code for the O button.
`static int` | `BUTTON_R1` Code for the right bumper button.
`static int` | `BUTTON_R2` Deprecated. This code is unreliable on some controller firmwares. Use of analog axis value is recommended.
`static int` | `BUTTON_R3` Code for right joystick button.
`static int` | `BUTTON_U` Code for the U button.
`static int` | `BUTTON_Y` Code for the Y button.
`static int` | `MAX_CONTROLLERS` The maximum number of connected controllers.
`static float` | `STICK_DEADZONE` The deadzone amount to use for the analog sticks.

Method Summary
`boolean` | `buttonChangedThisFrame(int ouyaButton)` Checks if a button state changed within the current frame loop (as signaled by calling startOfFrame).
`float` | `getAxisValue(int ouyaAxis)`
`boolean` | `getButton(int ouyaButton)`
`static OuyaController` | `getControllerByDeviceId(int deviceId)` Get the current state of a controller
`static OuyaController` | `getControllerByPlayer(int playerNum)` Get the controller for a specific player number
`android.view.InputDevice` | `getDevice()`
`int` | `getDeviceId()`
`int` | `getPlayerNum()`
`static int` | `getPlayerNumByDeviceId(int deviceId)` Get the player number for a specific device, in the range [0, MAX_CONTROLLERS), or -1 if no player found.
`static void` | `init(android.content.Context context)`
`static boolean` | `onGenericMotionEvent(android.view.MotionEvent event)` Called by the application to update the controller state
`static boolean` | `onKeyDown(int keyCode, android.view.KeyEvent event)` Called by the application to update the controller state
`static boolean` | `onKeyUp(int keyCode, android.view.KeyEvent event)` Called by the application to update the controller state
`static void` | `startOfFrame()` Signals the start of a new frame loop.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BUTTON_O

    public static final int BUTTON_O

  Code for the O button.

  See Also:
    Constant Field Values

### BUTTON_U

    public static final int BUTTON_U

  Code for the U button.

  See Also:
    Constant Field Values

### BUTTON_Y

    public static final int BUTTON_Y

  Code for the Y button.

  See Also:
    Constant Field Values

### BUTTON_A

    public static final int BUTTON_A

  Code for the A button.

  See Also:
    Constant Field Values

### BUTTON_L1

    public static final int BUTTON_L1

  Code for the left bumper button.

  See Also:
    Constant Field Values

### BUTTON_L2

    @Deprecated
    public static final int BUTTON_L2

  Deprecated. This code is unreliable on some controller firmwares. Use of analog axis value is recommended.
  Code for the left trigger button. Considered pressed when AXIS_L2 > 0.5

  See Also:
    Constant Field Values

### BUTTON_R1

    public static final int BUTTON_R1

  Code for the right bumper button.

  See Also:
    Constant Field Values

### BUTTON_R2

    @Deprecated
    public static final int BUTTON_R2

  Deprecated. This code is unreliable on some controller firmwares. Use of analog axis value is recommended.
  Code for the right trigger button. Considered pressed when AXIS_R2 > 0.5

  See Also:
    Constant Field Values

### BUTTON_MENU

    public static final int BUTTON_MENU

  Code for a short press of the system button.

  See Also:
    Constant Field Values

### AXIS_LS_X

    public static final int AXIS_LS_X

  Code for the left joystick x axis.

  See Also:
    Constant Field Values

### AXIS_LS_Y

    public static final int AXIS_LS_Y

  Code for the left joystick y axis.

  See Also:
    Constant Field Values

### AXIS_RS_X

    public static final int AXIS_RS_X

  Code for the right joystick x axis.

  See Also:
    Constant Field Values

### AXIS_RS_Y

    public static final int AXIS_RS_Y

  Code for the right joystick y axis.

  See Also:
    Constant Field Values

### AXIS_L2

    public static final int AXIS_L2

  Code for the left trigger axis. Use of this axis is recommended over the digital key event.

  See Also:
    Constant Field Values

### AXIS_R2

    public static final int AXIS_R2

  Code for the right trigger axis. Use of this axis is recommended over the digital key event.

  See Also:
    Constant Field Values

### BUTTON_DPAD_UP

    public static final int BUTTON_DPAD_UP

  Code for the D-pad up button.

  See Also:
    Constant Field Values

### BUTTON_DPAD_RIGHT

    public static final int BUTTON_DPAD_RIGHT

  Code for the D-pad right button.

  See Also:
    Constant Field Values

### BUTTON_DPAD_DOWN

    public static final int BUTTON_DPAD_DOWN

  Code for the D-pad down button.

  See Also:
    Constant Field Values

### BUTTON_DPAD_LEFT

    public static final int BUTTON_DPAD_LEFT

  Code for the D-pad left button.

  See Also:
    Constant Field Values

### BUTTON_R3

    public static final int BUTTON_R3

  Code for right joystick button.

  See Also:
    Constant Field Values

### BUTTON_L3

    public static final int BUTTON_L3

  Code for left joystick button.

  See Also:
    Constant Field Values

### MAX_CONTROLLERS

    public static final int MAX_CONTROLLERS

  The maximum number of connected controllers.

  See Also:
    Constant Field Values

### STICK_DEADZONE

    public static final float STICK_DEADZONE

  The deadzone amount to use for the analog sticks.

  See Also:
    Constant Field Values

Method Detail

### init

    public static void init(android.content.Context context)

### getControllerByDeviceId

    public static OuyaController getControllerByDeviceId(int deviceId)

  Get the current state of a controller

### getPlayerNumByDeviceId

    public static int getPlayerNumByDeviceId(int deviceId)

  Get the player number for a specific device, in the range [0, MAX_CONTROLLERS), or -1 if no player found.

### getControllerByPlayer

    public static OuyaController getControllerByPlayer(int playerNum)

  Get the controller for a specific player number

### onGenericMotionEvent

    public static boolean onGenericMotionEvent(android.view.MotionEvent event)

  Called by the application to update the controller state

### onKeyDown

    public static boolean onKeyDown(int keyCode,
                                    android.view.KeyEvent event)

  Called by the application to update the controller state

### onKeyUp

    public static boolean onKeyUp(int keyCode,
                                  android.view.KeyEvent event)

  Called by the application to update the controller state

### startOfFrame

    public static void startOfFrame()

  Signals the start of a new frame loop. Used to reset the "button changed this frame" logic.

### buttonChangedThisFrame

    public boolean buttonChangedThisFrame(int ouyaButton)

  Checks if a button state changed within the current frame loop (as signaled by calling startOfFrame).

  Returns:
    True if the button state changed this frame

### getDevice

    public android.view.InputDevice getDevice()

  Returns:
    The device for this controller

### getDeviceId

    public int getDeviceId()

  Returns:
    The deviceId for this controller

### getAxisValue

    public float getAxisValue(int ouyaAxis)

  Returns:
    The current axis value

### getButton

    public boolean getButton(int ouyaButton)

  Returns:
    The current button state

### getPlayerNum

    public int getPlayerNum()

  Returns:
    The player number associated with this controller, in the range [0, MAX_CONTROLLERS)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 OUYA, Inc. All Rights Reserved.