cbox.hw
Class Button

java.lang.Object
  extended by cbox.hw.Button

public class Button
extends Object

Abstraction for an C-Box button. Example:

    Button.RED.waitForPress();
 


Field Summary
static Button BLUE
          The Enter button.
static int BLUE_BUTTON
          The Enter button value.
static Button[] BUTTONS
          Array containing ENTER, LEFT, RIGHT, ESCAPE, in that order.
static Button LEFT
          The Left button.
static int LEFT_BUTTON
          The Left button value.
static Button RED
          The Escape button.
static int RED_BUTTON
          The Escape button value.
static Button RIGHT
          The Right button.
static int RIGHT_BUTTON
          The Right button value.
 
Method Summary
 int getId()
          Return the ID of the button.
 boolean isPressed()
          Check if the button is pressed.
static int readButtons()
          Low-level API that reads status of buttons.
static int waitForPress()
          wait for some button to be pressed
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Field Detail

BLUE_BUTTON

public static final int BLUE_BUTTON
The Enter button value. Used when reading raw value.

See Also:
Constant Field Values

LEFT_BUTTON

public static final int LEFT_BUTTON
The Left button value. Used when reading raw value.

See Also:
Constant Field Values

RIGHT_BUTTON

public static final int RIGHT_BUTTON
The Right button value. Used when reading raw value.

See Also:
Constant Field Values

RED_BUTTON

public static final int RED_BUTTON
The Escape button value. Used when reading raw value.

See Also:
Constant Field Values

BLUE

public static final Button BLUE
The Enter button.


LEFT

public static final Button LEFT
The Left button.


RIGHT

public static final Button RIGHT
The Right button.


RED

public static final Button RED
The Escape button.


BUTTONS

public static final Button[] BUTTONS
Array containing ENTER, LEFT, RIGHT, ESCAPE, in that order.

Method Detail

getId

public final int getId()
Return the ID of the button. One of 1, 2, 4 or 8.


isPressed

public final boolean isPressed()
Check if the button is pressed.

Returns:
true if button is pressed, false otherwise.

waitForPress

public static int waitForPress()
wait for some button to be pressed

Returns:
the ID of that button, the same as readButtons();

readButtons

public static int readButtons()
Low-level API that reads status of buttons.

Returns:
An integer with possibly some bits set: 0x01 (ENTER button pressed) 0x02 (LEFT button pressed), 0x04 (RIGHT button pressed), 0x08 (ESCAPE button pressed). If all buttons are released, this method returns 0.