KPADStatus

Syntax

#include <revolution/kpadOld.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 for the instant the button is pressed.
release The flag is enabled only for the instant the button is released.
acc Acceleration sensor value. Note the coordinate system. In contrast to the WPAD library, when the Wii Remote is pointed toward the TV screen, the forward direction is Z+, upward direction is Y+, and leftward direction is X+.
acc_value Magnitude of acceleration (length of x, y, and z).
acc_speed Change in acceleration (length of the difference along the x-, y-, and z-axes relative to the previous values).
pos Pointing position. Forward is zero. Down and right are the positive directions.
vec Difference from the previous pointing position.
speed Length of difference from the previous pointing position.
horizon Directional vector of the pointer's horizontal plane. The vector has a magnitude of 1, and the positive directions are to the right and down.
hori_vec Difference from the previous directional vector.
hori_speed Magnitude of difference from the previous directional vector.
dist Distance between the Sensor Bar, set on the TV, and the Wii Remote. The unit is meter.
dist_vec Difference from previous distance data.
dist_speed Magnitude of the difference from previous distance data.
acc_vertical The top-bottom orientation of the Wii Remote as obtained from the accelerometer. When the remote is facing forward, the result for this 2D vector of length 1 is (1,0). Coordinate x is always positive, never negative. When y is positive, the Wii 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 Controller type (WPAD_DEV_*). For details, see the WPADStatus structure page.
ex_status The KPADEXStatus union that maintains 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; 0 indicates 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. The element pos stores a value in the range of about -1 to +1, in which objects can be captured by the pointer. (Values whose absolute exceeds 1 may also be output.) For example, to use the screen coordinate environment where (0,0) is the screen center and 600 is the screen width, multiply this value by 300. dpd_valid_fg indicates whether or not the pointer information was calculated correctly. If this value is not zero, the calculations have completed; however, if the value is not 2, the calculations are unreliable. It may be better not to handle a negative value as valid, especially in the environment whose light source is other than a normal object. 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, 1, 2, + (plus), - (minus), and HOME are located on the Wii Remote. The digital buttons Z and C are located on the Nunchuk.
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 A Button is being pressed.
KPAD_BUTTON_B B Button is being pressed.
KPAD_BUTTON_HOME HOME is being pressed.
KPAD_BUTTON_PLUS_ + Button is being pressed.
KPAD_BUTTON_MINUS - Button is being pressed.
KPAD_BUTTON_1 1 Button is being pressed.
KPAD_BUTTON_2 2 Button is being pressed.
KPAD_BUTTON_Z The Nunchuk's Z Button is being pressed.
KPAD_BUTTON_C The Nunchuk's C Button is being pressed.
Note: The number and layout of the buttons on the Wii Remote are subject to change.

The following macro constants are used with UI Tool version 3 and earlier:
KPAD_BUTTON_SMALL_A1 Button is being pressed.
KPAD_BUTTON_SMALL_B2 Button is being pressed.
KPAD_BUTTON_SELECT SELECT is being pressed.
KPAD_BUTTON_START START is being pressed.
KPAD_BUTTON_Z1 The Nunchuk's Z Button is being pressed.
KPAD_BUTTON_Z2 The Nunchuk's C Button is being pressed.

Macros that correspond to the input of the Nintendo GameCube standard controller button are defined as follows:
KPAD_GC_BUTTON_UP UP is being pressed on the +Control Pad.
KPAD_GC_BUTTON_DOWN DOWN is being pressed on the +Control Pad.
KPAD_GC_BUTTON_LEFT LEFT is being pressed on the +Control Pad.
KPAD_GC_BUTTON_RIGHT RIGHT is being pressed on the +Control Pad.
KPAD_GC_BUTTON_A A Button is being pressed on the +Control Pad.
KPAD_GC_BUTTON_B B Button is being pressed on the +Control Pad.
KPAD_GC_BUTTON_X X Button is being pressed on the +Control Pad.
KPAD_GC_BUTTON_Y Y Button is being pressed on the +Control Pad.
KPAD_GC_BUTTON_Z, KPAD_GC_TRIGGER_ZZ Button is being pressed on the +Control Pad.
KPAD_GC_BUTTON_START START/PAUSE button is being pressed on the +Control Pad.
KPAD_GC_TRIGGER_R, KPAD_GC_BUTTON_RR Button is being pressed on the +Control Pad.
KPAD_GC_TRIGGER_L, KPAD_GC_BUTTON_LL Button is being pressed on the +Control Pad.

The macros that correspond to the input from a Classic Controller button are defined as follows:
KPAD_CL_BUTTON_UP +Control Pad UP is being pressed.
KPAD_CL_BUTTON_DOWN +Control Pad DOWN is being pressed.
KPAD_CL_BUTTON_LEFT +Control Pad LEFT is being pressed.
KPAD_CL_BUTTON_RIGHT+Control Pad RIGHT is being pressed.
KPAD_CL_BUTTON_A A Button is being pressed.
KPAD_CL_BUTTON_B B Button is being pressed.
KPAD_CL_BUTTON_X X Button is being pressed.
KPAD_CL_BUTTON_Y Y Button is being pressed.
KPAD_CL_BUTTON_PLUS +/START Button is being pressed.
KPAD_CL_BUTTON_HOME HOME is being pressed.
KPAD_CL_BUTTON_MINUS-/SELECT Button is being pressed.
KPAD_CL_TRIGGER_L L Button is being pressed.
KPAD_CL_TRIGGER_R R Button is being pressed.
KPAD_CL_TRIGGER_ZL ZL Button is being pressed.
KPAD_CL_TRIGGER_ZR ZR Button is being pressed.
For details on the error codes, see WPAD Library Manual.

See Also

KPADRead

Revision History

2006/10/25 Changed the name to KPADOld library, beginning with Revolution SDK 2.3.
2006/08/xx Added the description of the acc_vertical member variable of the KPADStatus structure.
2006/08/xx Changed some macro contents that correspond to the buttons on the Wii Remote and Nunchuk.
2006/08/xx Added macro constants for the Classic Controller.
2006/06/19 Changed tentative product name to official name.
2006/03/01 Initial version.


CONFIDENTIAL