KPADStatus

Syntax

#include <cafe/pads/kpad/kpad.h>

typedef struct KPADStatus{
    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 ;

    u8   dev_type ;
    s8   wpad_err ;
    s8   dpd_valid_fg ;
    u8   data_format ;
    
    KPADEXStatus    ex_status ;

    KPADMPStatus mpls ;

    u8   __paddings__[ 4 ] ;

} 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. If the Sensor Bar of DRC is used, dist cannot be obtained correctly.
dist_vec Difference from previous distance data. If the Sensor Bar of DRC is used, dist_vec cannot be obtained correctly.
dist_speed Magnitude of the difference from previous distance data. If the Sensor Bar of DRC is used, dist_speed cannot be obtained correctly.
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 information, see the WPADStatus structure page.
wpad_err Error status of the WPADStatus structure.
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 reliable.
data_format The return value of WPADGetDataFormat is stored in a u8 type.
ex_status The KPADEXStatus union that maintains the expanded controller information. Access this union using the wpad_err, dev_type, and data_format values.
mpls KPADMPStatus structure stores Wii MotionPlus information. This structure is updated only while a work area has been set using the KPADSetMplsWorkarea function.

Return Values

Button Input

Button input is defined with the following macro constants. The digital buttons +Control Pad, A, B, 1, 2, + (plus), − (minus), and HOME Button 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 Button 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 controller's Z Button is being pressed.
KPAD_BUTTON_C The Nunchuk controller's C Button is being pressed.

Error Status

For information on the error status, see the WPAD Library Manual.

Description

This structure stores the controller information described in the table above that is obtained with the KPADRead function. The pos element stores values in the range of about −1 to +1; in this range, 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 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. The effectiveness of the button and acceleration information may be determined based on wpad_err, dev_type, and data_format value, independent of this value.

See Also

KPADRead
KPADEXStatus
KPADMPStatus

Revision History

2013/05/08 Automated cleanup pass.
2008/12/04 Changed the mpls member from Vec type to the KPADMPStatus structure.
2008/09/30 Explained the Wii MotionPlus.
2006/10/25 Revised the description to match KPAD version 2.
2006/08/01 Added the description of the acc_vertical member variable of the KPADStatus structure.
2006/08/01 Changed some macro contents that correspond to the buttons on the Wii remote and Nunchuk.
2006/08/01 Added macro constants for the Classic Controller.
2006/06/19 Changed tentative product name to official name.
2006/03/01 Initial version.


CONFIDENTIAL