tv.ouya.console.api
Class OuyaController

java.lang.Object
  extended by 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 java.util.List<java.lang.Integer> AVAILABLE_AXES
           
static java.util.List<java.lang.Integer> AVAILABLE_BUTTONS
           
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
          Code for the left trigger button.
static int BUTTON_L3
          Code for left joystick button.
static int BUTTON_O
          Code for the O button.
static int BUTTON_R1
          Code for the right bumper button.
static int BUTTON_R2
          Code for the right trigger button.
static int BUTTON_R3
          Code for right joystick button.
static int BUTTON_SYSTEM
          Code for the system menu button.
static int BUTTON_U
          Code for the U button.
static int BUTTON_Y
          Code for the Y button.
static int MAX_CONTROLLERS
           
 
Method Summary
 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 interpret(int keyCode)
          Deprecated. 
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
 
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

public static final int BUTTON_L2
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. Considered pressed when AXIS_R2 > 0.5

See Also:
Constant Field Values

BUTTON_R2

public static final int BUTTON_R2
Code for the right trigger button.

See Also:
Constant Field Values

BUTTON_SYSTEM

public static final int BUTTON_SYSTEM
Code for the system menu 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

See Also:
Constant Field Values

AXIS_R2

public static final int AXIS_R2
Code for the right trigger axis

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

AVAILABLE_AXES

public static java.util.List<java.lang.Integer> AVAILABLE_AXES

AVAILABLE_BUTTONS

public static java.util.List<java.lang.Integer> AVAILABLE_BUTTONS

MAX_CONTROLLERS

public static final int MAX_CONTROLLERS
See Also:
Constant Field Values
Method Detail

interpret

@Deprecated
public static int interpret(int keyCode)
Deprecated. 


getControllerByDeviceId

public static OuyaController getControllerByDeviceId(int deviceId)
Get the current state of a controller


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


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 (0-3)


Copyright © 2012 OUYA, Inc. All Rights Reserved.