#include <revolution/kpad.h> void KPADSetBtnRepeat( s32 chan, f32 delay_sec, f32 pulse_sec );
| chan | One of the WPAD_CHANn values. |
|---|---|
| delay_sec | Specifies the time for holding down the button before the KPAD_BUTTON_RPT flag is set. |
| pulse_sec | If the KPAD_BUTTON_RPT flag is enabled delay_sec seconds after a button is pressed and held down, pulse_sec will specify the time interval (in seconds) at which the KPAD_BUTTON_RPT flag should be enabled thereafter. If you do not want this flag enabled at all, set pulse_sec to 0. |
None.
Sets the repeat feature of the digital button (described in the KPADStatus structure). When a button is pressed and held, the KPAD_BUTTON_RPT flag can be periodically enabled in the hold member variable of KPADStatus. delay_sec seconds after a button is pressed, the KPAD_BUTTON_RPT flag gets set every pulse_sec seconds. In the example shown below, a program is created (using the flags) to perform an action periodically when a button is pressed and held down.
if ( (hold & (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) == (KPAD_BUTTON_RPT | KPAD_BUTTON_A) ) {Your routine}
Note that repeat settings are not maintained for each button. In this example, if another button is pressed while the A Button is held, the repeat status will be completely reset. On the Wii Menu, delay_sec is set to 0.5, and pulse_sec is set to 0.1. Set these values to match Wii Menu behavior.
A repeat feature is available for both the Nunchuk and Classic Controller buttons. The Nunchuk as well as Wii Remote buttons are included in the KPADStatus structure's hold member variable; repeat management is common between the two.
The Classic Controller buttons, which are included in the KPADEXStatus structure's hold member variable, can set the KPAD_BUTTON_RPT flag. The repeat management for the Wii Remote buttons is independent of that for the Classic Controller buttons.
None.
2008/07/08 Added information on settings in the Wii Menu.
2006/10/25 Revised the description to match KPAD version 2.
2006/03/01 Initial version.
CONFIDENTIAL