WRNunchukExtensionEvent
Keywords: wiiremotej.event.WRNunchukExtensionEvent class

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

## wiiremotej.event
Class WRNunchukExtensionEvent

    java.lang.Object
      java.util.EventObject
          wiiremotej.event.WREvent
              wiiremotej.event.WRExtensionEvent
                  wiiremotej.event.WRNunchukExtensionEvent

All Implemented Interfaces:
  java.io.Serializable

    public class WRNunchukExtensionEvent

extends WRExtensionEvent

Nunchuk extension event for Nintendo (R) Wii Remote (TM). Contains data from the Nunchuk extension.

See Also:
  Serialized Form

Field Summary
`static int` | `C` Constant representing the C button of the Nunchuk.
`static int` | `Z` Constant representing the Z button of the Nunchuk.

Fields inherited from class java.util.EventObject
`source`

Constructor Summary
`WRNunchukExtensionEvent(WiiRemote source, byte[] input, int offset, WRNunchukExtensionEvent lastEvent)` Creates a new WRNunchukExtensionEvent from an array of input data.
`WRNunchukExtensionEvent(WiiRemote source, WRAccelerationEvent accelerationEvent, int buttonsPressed, AnalogStickData analogStickData, WRNunchukExtensionEvent lastEvent)` Creates a new WRNunchukExtensionEvent from the given parameters.

Method Summary
`static WRNunchukExtensionEvent` | `createBlankEvent()` Returns a WRNunchukExtensionEvent with all the values cleared.
`WRAccelerationEvent` | `getAcceleration()` Returns the acceleration part of this Nunchuk event.
`AnalogStickData` | `getAnalogStickData()` Returns AnalogStickData representing the current state of the analog stick on the Nunchuk.
`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

### C

    public static final int C

  Constant representing the C button of the Nunchuk.

  See Also:
    Constant Field Values

### Z

    public static final int Z

  Constant representing the Z button of the Nunchuk.

  See Also:
    Constant Field Values

Constructor Detail

### WRNunchukExtensionEvent

    public WRNunchukExtensionEvent(WiiRemote source,
                                   byte[] input,
                                   int offset,
                                   WRNunchukExtensionEvent lastEvent)

  Creates a new WRNunchukExtensionEvent from an array of input data.

  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 WRNunchukExtensionEvent. Used for button-press information.

### WRNunchukExtensionEvent

    public WRNunchukExtensionEvent(WiiRemote source,
                                   WRAccelerationEvent accelerationEvent,
                                   int buttonsPressed,
                                   AnalogStickData analogStickData,
                                   WRNunchukExtensionEvent lastEvent)

  Creates a new WRNunchukExtensionEvent from the given parameters.

  Parameters:
    `source` - the WiiRemote triggering this event.
    `accelerationEvent` - the acceleration part of this Nunchuk event.
    `buttonsPressed` - the buttonsPressed mask for this event (i.e. the sum of all the depressed buttons).
    `lastEvent` - the last received WRNunchukExtensionEvent. Used for wasPressed and wasReleased information.

Method Detail

### createBlankEvent

    public static WRNunchukExtensionEvent createBlankEvent()

  Returns a WRNunchukExtensionEvent with all the values cleared. This means that all acceleration and analog values read are 0 and all buttons are not pressed.

  Returns:
    a WRNunchukExtensionEvent with all the values cleared.

### getAcceleration

    public WRAccelerationEvent getAcceleration()

  Returns the acceleration part of this Nunchuk event.

  Returns:
    the acceleration part of this Nunchuk event.

### getAnalogStickData

    public AnalogStickData getAnalogStickData()

  Returns AnalogStickData representing the current state of the analog stick on the Nunchuk.

  Returns:
    AnalogStickData representing the current state of the analog stick on the Nunchuk.

### 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`.

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