wiiremotej.event
Class WRClassicControllerExtensionEvent

java.lang.Object
  extended by java.util.EventObject
      extended by wiiremotej.event.WREvent
          extended by wiiremotej.event.WRExtensionEvent
              extended by wiiremotej.event.WRClassicControllerExtensionEvent
All Implemented Interfaces:
java.io.Serializable

public class WRClassicControllerExtensionEvent
extends WRExtensionEvent

Classic controller extension event for Nintendo (R) Wii Remote (TM). Contains data from the classic controller extension. Be aware that if buttons are held when the controller is first connected (or the remote is turned on while the controller is plugged in), calibration data may be inaccurate.

See Also:
Serialized Form

Field Summary
static int A
          Constant representing the A button of the Classic Controller.
static int B
          Constant representing the B button of the Classic Controller.
static int DPAD_DOWN
          Constant representing the D-Pad down button of the Classic Controller.
static int DPAD_LEFT
          Constant representing the D-Pad left button of the Classic Controller.
static int DPAD_RIGHT
          Constant representing the D-Pad right button of the Classic Controller.
static int DPAD_UP
          Constant representing the D-Pad up button of the Classic Controller.
static int HOME
          Constant representing the home button of the Classic Controller.
static int LEFT_TRIGGER
          Constant representing the left trigger button of the Classic Controller.
static int LEFT_Z
          Constant representing the left Z button of the Classic Controller.
static int MINUS
          Constant representing the minus button of the Classic Controller.
static int PLUS
          Constant representing the plus button of the Classic Controller.
static int RIGHT_TRIGGER
          Constant representing the right trigger button of the Classic Controller.
static int RIGHT_Z
          Constant representing the right Z button of the Classic Controller.
static int X
          Constant representing the X button of the Classic Controller.
static int Y
          Constant representing the Y button of the Classic Controller.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
WRClassicControllerExtensionEvent(WiiRemote source, AnalogStickData leftAnalogStickData, AnalogStickData rightAnalogStickData, int buttonsPressed, double leftTrigger, double rightTrigger, WRClassicControllerExtensionEvent lastEvent)
          Creates a new WRClassicControllerExtensionEvent from the given settings.
WRClassicControllerExtensionEvent(WiiRemote source, byte[] input, int offset, WRClassicControllerExtensionEvent lastEvent)
          Creates a new WRClassicControllerExtensionEvent from an array of input data from the Wii Remote.
 
Method Summary
static WRClassicControllerExtensionEvent createBlankEvent()
          Returns a WRClassicControllerExtensionEvent with all the values cleared.
 AnalogStickData getLeftAnalogStickData()
          Returns AnalogStickData representing the current state of the left analog stick on the classic controller.
 double getLeftTrigger()
          Returns the amount the left trigger button is depressed.
 AnalogStickData getRightAnalogStickData()
          Returns AnalogStickData representing the current state of the right analog stick on the classic controller.
 double getRightTrigger()
          Returns the amount the right trigger button is depressed.
 boolean isAnyPressed(int buttonMask)
          Returns true if any of the given buttons are pressed; otherwise false.
 boolean isOnlyPressed(int buttonMask)
          Returns true if all of the given buttons are pressed and no others are; otherwise false.
 boolean isPressed(int buttonMask)
          Returns true if all of the given buttons are pressed; otherwise false.
 boolean wasOnlyPressed(int buttonMask)
          Returns true if all of the given buttons were pressed and no others are; otherwise false.
 boolean wasPressed(int buttonMask)
          Returns true if all of the given buttons were pressed; otherwise false.
 boolean wasReleased(int buttonMask)
          Returns true if one of the given buttons was released; otherwise false.
 
Methods inherited from class wiiremotej.event.WREvent
getSource
 
Methods inherited from class java.util.EventObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DPAD_UP

public static final int DPAD_UP
Constant representing the D-Pad up button of the Classic Controller.

See Also:
Constant Field Values

DPAD_LEFT

public static final int DPAD_LEFT
Constant representing the D-Pad left button of the Classic Controller.

See Also:
Constant Field Values

RIGHT_Z

public static final int RIGHT_Z
Constant representing the right Z button of the Classic Controller.

See Also:
Constant Field Values

X

public static final int X
Constant representing the X button of the Classic Controller.

See Also:
Constant Field Values

A

public static final int A
Constant representing the A button of the Classic Controller.

See Also:
Constant Field Values

Y

public static final int Y
Constant representing the Y button of the Classic Controller.

See Also:
Constant Field Values

B

public static final int B
Constant representing the B button of the Classic Controller.

See Also:
Constant Field Values

LEFT_Z

public static final int LEFT_Z
Constant representing the left Z button of the Classic Controller.

See Also:
Constant Field Values

RIGHT_TRIGGER

public static final int RIGHT_TRIGGER
Constant representing the right trigger button of the Classic Controller.

See Also:
Constant Field Values

PLUS

public static final int PLUS
Constant representing the plus button of the Classic Controller.

See Also:
Constant Field Values

HOME

public static final int HOME
Constant representing the home button of the Classic Controller.

See Also:
Constant Field Values

MINUS

public static final int MINUS
Constant representing the minus button of the Classic Controller.

See Also:
Constant Field Values

LEFT_TRIGGER

public static final int LEFT_TRIGGER
Constant representing the left trigger button of the Classic Controller.

See Also:
Constant Field Values

DPAD_DOWN

public static final int DPAD_DOWN
Constant representing the D-Pad down button of the Classic Controller.

See Also:
Constant Field Values

DPAD_RIGHT

public static final int DPAD_RIGHT
Constant representing the D-Pad right button of the Classic Controller.

See Also:
Constant Field Values
Constructor Detail

WRClassicControllerExtensionEvent

public WRClassicControllerExtensionEvent(WiiRemote source,
                                         byte[] input,
                                         int offset,
                                         WRClassicControllerExtensionEvent lastEvent)
Creates a new WRClassicControllerExtensionEvent from an array of input data from the Wii Remote.

Parameters:
source - the WiiRemote triggering this event.
input - data received from the extension port.
offset - the position of the first byte of extension data in the array.
lastEvent - the last received WRClassicControllerExtensionEvent. Used for button-press information.

WRClassicControllerExtensionEvent

public WRClassicControllerExtensionEvent(WiiRemote source,
                                         AnalogStickData leftAnalogStickData,
                                         AnalogStickData rightAnalogStickData,
                                         int buttonsPressed,
                                         double leftTrigger,
                                         double rightTrigger,
                                         WRClassicControllerExtensionEvent lastEvent)
Creates a new WRClassicControllerExtensionEvent from the given settings.

Parameters:
source - the WiiRemote triggering this event.
leftAnalogStickData - analog stick data for the left analog stick.
rightAnalogStickData - analog stick data for the right analog stick.
buttonsPressed - the buttonsPressed mask for this event (i.e. the sum of all the depressed buttons).
leftTrigger - how much the left trigger is depressed.
rightTrigger - how much the right trigger is depressed
lastEvent - the last received WRClassicControllerExtensionEvent. Used for wasPressed and wasReleased information.
Method Detail

createBlankEvent

public static WRClassicControllerExtensionEvent createBlankEvent()
Returns a WRClassicControllerExtensionEvent with all the values cleared. This means that all acceleration and analog values read are 0 and all buttons are not pressed.

Returns:
a WRClassicControllerExtensionEvent with all the values cleared.

getLeftAnalogStickData

public AnalogStickData getLeftAnalogStickData()
Returns AnalogStickData representing the current state of the left analog stick on the classic controller.

Returns:
AnalogStickData representing the current state of the left analog stick on the classic controller.

getRightAnalogStickData

public AnalogStickData getRightAnalogStickData()
Returns AnalogStickData representing the current state of the right analog stick on the classic controller.

Returns:
AnalogStickData representing the current state of the right analog stick on the classic controller.

getLeftTrigger

public double getLeftTrigger()
Returns the amount the left trigger button is depressed. This is a percent (from 0 to 1). See isPressed() for a simple pressed/not-pressed status.

Returns:
the amount the left trigger button is depressed.
See Also:
isPressed(int buttonMask)

getRightTrigger

public double getRightTrigger()
Returns the amount the right trigger button is depressed. This is a percent (from 0 to 1). See isPressed() for a simple pressed/not-pressed status.

Returns:
the amount the right trigger button is depressed.
See Also:
isPressed(int buttonMask)

isPressed

public boolean isPressed(int buttonMask)
Returns true if all of the given buttons are pressed; otherwise false. "isPressed" means that the buttons are currently depressed; they may have just been depressed this event, or they may have been depressed previously. Buttons are specified using the field constants in this class.

Parameters:
buttonMask - the button(s) to check if is pressed. You may specify either a single button or a button mask (multiple buttons added together).
Returns:
true if the given buttons are pressed; otherwise false.

isOnlyPressed

public boolean isOnlyPressed(int buttonMask)
Returns true if all of the given buttons are pressed and no others are; otherwise false. "isPressed" means that the buttons are currently depressed; they may have just been depressed this event, or they may have been depressed previously. Buttons are specified using the field constants in this class.

Parameters:
buttonMask - the button(s) to check if is pressed. You may specify either a single button or a button mask (multiple buttons added together).
Returns:
true if the given buttons are pressed and no others are; otherwise false.

isAnyPressed

public boolean isAnyPressed(int buttonMask)
Returns true if any of the given buttons are pressed; otherwise false. "isPressed" means that the buttons are currently depressed; they may have just been depressed this event, or they may have been depressed previously. Buttons are specified using the field constants in this class. If the button mask contains only one button, this method is the same as isPressed(buttonMask).

Parameters:
buttonMask - the button(s) to check if is pressed. You may specify either a single button or a button mask (multiple buttons added together).
Returns:
true if any of the given buttons are pressed; otherwise false.

wasPressed

public boolean wasPressed(int buttonMask)
Returns true if all of the given buttons were pressed; otherwise false. "wasPressed" means that the buttons were not depressed before, and were just depressed this event. Buttons are specified using the field constants in this class.

Parameters:
buttonMask - the button(s) to check if was pressed. You may specify either a single button or a button mask (multiple buttons added together). If you use a button mask (i.e. multiple buttons), then this method returns true when the buttons described by button are depressed (isPressed(buttonMask) returns true) and at least one of the buttons was just depressed (i.e. it was previously not depressed).
Returns:
true if the given buttons were pressed; otherwise false.

wasOnlyPressed

public boolean wasOnlyPressed(int buttonMask)
Returns true if all of the given buttons were pressed and no others are; otherwise false. "wasPressed" means that the buttons were not depressed before, and were just depressed this event. Buttons are specified using the field constants in this class.

Parameters:
buttonMask - the button(s) to check if was pressed. You may specify either a single button or a button mask (multiple buttons added together). If you use a button mask (i.e. multiple buttons), then this method returns true when the buttons described by button are depressed (isOnlyPressed(buttonMask) returns true) and at least one of the buttons was just depressed (i.e. it was previously not depressed).
Returns:
true if the given buttons were pressed and no others are; otherwise false.

wasReleased

public boolean wasReleased(int buttonMask)
Returns true if one of the given buttons was released; otherwise false. "wasReleased" means that the buttons were previously depressed, but that at least one was just released this event. Buttons are specified using the field constants in this class.

Parameters:
buttonMask - the button(s) to check if was released. You may specify either a single button or a button mask (multiple buttons added together). If you use a button mask, (i.e. multiple buttons), then this method returns true when all buttons were depressed previously (isPressed(buttonMask) returned true last event), and at least one of them has been released ((isPressed(buttonMask) now returns false).
Returns:
true if the given buttons were released; otherwise false.