KPADStatus

C Specification

#include <revolution/kpad.h>

typedef struct {
    u32  hold ;
    u32  trig ;
    u32  release ;

    Vec  acc ;
    f32  acc_value ;
    f32  acc_speed ;

    Vec2 pos ;
    Vec2 vec ;
    f32  speed ;

    Vec2 horizon ;
    Vec2 hori_vec ;
    f32  hori_speed ;

    f32  dist ;
    f32  dist_vec ;
    f32  dist_speed ;

    Vec2 acc_vertical ;

    u32  dev_type ;

    KPADEXStatus    ex_status ;

    s8   dpd_valid_fg ;
    s8   wpad_err ;
} KPADStatus ;

Elements

hold The flag is enabled while the button is pressed.
trig The flag is enabled only the instant the button is pressed.
release The flag is enabled only the instant the button is released.
acc Acceleration sensor value. Note the coordinate system. Unlike the WPAD library, when the Wii Remote Control is pointed toward the TV screen, the forward direction is Z+, the upward direction is Y+, and leftward direction is X+.
acc_value Indicates the magnitude of the acceleration (length of x, y, and z).
acc_speed Indicates the change in acceleration (length of the difference along the x-, y-, and z-axes relative to the previous values).
pos Indicates the pointing position. Forward is zero. Down and right are the positive directions.
vec Indicates the difference from the previous pointing position.
speed Indicates the length of the difference from the previous pointing position.
horizon Indicates the directional vector of the DPD's horizontal plane. The vector has a magnitude of 1, and the positive directions are to the right and down.
hori_vec Indicates the difference from the previous directional vector.
hori_speed Indicates the magnitude of the difference from the previous directional vector.
dist Indicates the distance between the Sensor Bar set on the TV and the Wii Remote Control. The units are meters.
dist_vec Indicates the difference from the previous distance data.
dist_speed Indicates the magnitude of the difference from the previous distance data.
acc_vertical Represents top-bottom orientation of the Wii Remote as obtained from the accelerometer. (1,0) results for this 2D vector of length 1 when the remote is facing forward. x is always positive and never negative. When y is positive, the Remote is facing upward; when negative, it is facing downward. This variable is not reflected in the play radius and sensitivity settings for KPAD.
dev_type Indicates the controller type (WPAD_DEV_*). For details, see the WPADStatus structure page.
ex_status The KPADEXStatus union maintaining the expanded controller information. Programmers must access this union based on the value of dev_type.
dpd_valid_fg Maintains the number of objects that were used to recognize the pointing position. It is normally 1 or 2, with 0 indicating an invalid position. A stored negative value indicates that the recognition result is not very reliable.
wpad_err The WPADStatus structure error code.

Description

This structure stores the controller information obtained with the KPADRead function.
pos stores a value of the range in which objects can be captured by the DPD as roughly between -1 and 1. (Values with an absolute value exceeding 1 may also be output.) For example, multiply this value by 300 to use screen coordinates having (0,0) as the screen center and a screen width of 600.
dpd_valid_fg indicates whether or not the DPD information was calculated correctly. If this value is non-zero, it means that the calculations were completed. But if it's not 2, the calculations have a low degree of reliability. Especially when using in an environment where there is a light source other than the normal objects, it may be better not to determine a negative value as valid.
Button information and acceleration information are unrelated to this value. Their validity can be determined with wpad_err alone.

Button inputs are defined with the following macro constants. The digital buttons + Control Pad, A, B, a, b, SELECT, START, and HOME are located on the Wii Remote Control. The digital buttons Z and C are located on the Nunchaku unit.
KPAD_BUTTON_UP +Control Pad UP is being pressed.
KPAD_BUTTON_DOWN +Control Pad DOWN is being pressed.
KPAD_BUTTON_LEFT +Control Pad LEFT is being pressed.
KPAD_BUTTON_RIGHT +Control Pad RIGHT is being pressed.
KPAD_BUTTON_A The A Button is being pressed.
KPAD_BUTTON_B The B Button is being pressed.
KPAD_BUTTON_SMALL_AThe 1 Button is being pressed.
KPAD_BUTTON_SMALL_BThe 2 Button is being pressed.
KPAD_BUTTON_SELECT BACK is being pressed.
KPAD_BUTTON_START PAUSE is being pressed.
KPAD_BUTTON_HOME HOME is being pressed.
KPAD_BUTTON_Z1 The Z Button on the Nunchaku Controller is being pressed.
KPAD_BUTTON_Z2 The C Button on the Nunchaku Controller is being pressed.
Note:The number and layout of the buttons on the Wii Remote are subject to change.

Macros corresponding to Nintendo GameCube standard controller button input are defined as follows.
KPAD_GC_BUTTON_LEFT The left button on the +Control Pad of the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_RIGHT The right button on the +Control Pad of the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_DOWN The down button on the +Control Pad of the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_UP The up button on the +Control Pad of the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_A The A Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_B The B Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_X The X Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_Y The Y Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_Z, KPAD_GC_TRIGGER_ZThe Z Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_BUTTON_START The START/PAUSE button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_TRIGGER_R, KPAD_GC_BUTTON_RThe R Button on the Nintendo GameCube standard controller is being pressed.
KPAD_GC_TRIGGER_L, KPAD_GC_BUTTON_LThe L Button on the Nintendo GameCube standard controller is being pressed.
For details on the error codes, see the WPAD Library Manual.

See Also

Revision History

03/01/2006 Initial version.
06/19/2006 Changed tentative product name to official name.
8/xx/2006 Added a description of the acc_vertical member variable of the xx KPADStatus structure.


CONFIDENTIAL