Functions | |
void | hel_PadCapture (void) |
Capture current pad state. | |
u32 | hel_PadGetTicks (u32 Button) |
Get ticks. | |
void | hel_PadInit (void) |
Initialize the pad system. | |
const TPad * | hel_PadQuery (void) |
Query Pad. | |
void | hel_PadQuit (void) |
Uninitialize pad system. | |
void | hel_PadSetMode (u32 Mode) |
Set Pad mode. | |
void | hel_PadSetRepeatDelay (u32 Buttons, u8 Ticks) |
Set repeat delay. | |
void | hel_PadSetRepeatRate (u32 Buttons, u8 Ticks) |
Set repeat rate. |
You can specify a repeat delay as well as repeat rate which trigger the pressed state to simulate button presses.
The pad supports two behaviours. The so called 'pressed state', which is either set when the button is pushed or released. The default press-behaviour after initializing or resetting the Pad-System is when the button is pushed.
The pad information structure is defined as followed:
typedef struct ATTR_PACKED _TPadButtons { union { struct { u8 A:1; // -A- u8 B:1; // -B- u8 Select:1; // -Select- u8 Start:1; // -Start- u8 Right:1; // -Right- u8 Left:1; // -Left- u8 Up:1; // -Up- u8 Down:1; // -Down- u8 R:1; // -R-, ShoulderButton u8 L:1; // -L-, ShoulderButton }; u16 States; u8 Data[]; // Memory to hold key repeat information and such }; }TPadButtons, *PPadButtons; typedef struct _TPad { TPadButtons Pressed; // Holds information about what buttons have been pressed, since last #hel_PadCapture call TPadButtons Held; // Holds information about what buttons are held down, since last #hel_PadCapture call u8 Mode; // Specifies the pad mode, if you want the Pressed-State on button push or release }TPad, *PPad;
void hel_PadCapture | ( | void | ) |
Capture current pad state.
The hel_PadCapture function captures the current Pad states. This function must be called only once per frame and before querying the pad.
u32 hel_PadGetTicks | ( | u32 | Button | ) |
Get ticks.
The hel_PadGetTicks function returns the ticks of the button in question.
[in] | Button | Button to retrieve the ticks for. Must be one of the PAD_BUTTON_* defines. |
Button
must not be a combination, it must represent the value of only one button instead.Valid:
u32 Ticks = hel_PadGetTicks(PAD_BUTTON_A);
Invalid:
u32 Ticks = hel_PadGetTicks(PAD_BUTTON_A | PAD_BUTTON_B);
void hel_PadInit | ( | void | ) |
Initialize the pad system.
The hel_PadInit function must be called once before using any of the Pad-System-Functions.
const TPad* hel_PadQuery | ( | void | ) |
Query Pad.
The hel_PadQuery function can be used to query the pad.
Here is an example to query the pad:
if(hel_PadQuery()->Held.Left) { // Left direction button held } if(hel_PadQuery()->Pressed.A) { // -A- button pressed }
void hel_PadQuit | ( | void | ) |
Uninitialize pad system.
The hel_PadQuit uninitializes the Pad-System and clears all current states set in hel_Pad
.
void hel_PadSetMode | ( | u32 | Mode | ) |
Set Pad mode.
The Pad-mode has only impact on the Pressed
state. It can be specified if the pad button is marked as pressed when it is either pushed (button down) or released (button up).
[in] | Mode | Specifies the new behaviour. This must be one of these values:
|
void hel_PadSetRepeatDelay | ( | u32 | Buttons, | |
u8 | Ticks | |||
) |
Set repeat delay.
The hel_PadSetRepeatDelay function can be used to set the button repeat delay. The repeat delay represent the ticks that have to elapse until the repeat rate takes place. For more information about ticks, please see hel_PadGetTicks.
[in] | Buttons | Button(s) to set the repeat rate for. Must be one or a combination of the PAD_BUTTON_* defines. |
[in] | Ticks | Ticks that have to elapse until the repeat rate takes place. To turn off repeat delay, pass 0 (zero). |
void hel_PadSetRepeatRate | ( | u32 | Buttons, | |
u8 | Ticks | |||
) |
Set repeat rate.
The hel_PadSetRepeatRate function can be used to set the button repeat rate. The repeat rate is the amount of ticks that have to elapse, until a button pressed state gets triggered. For more information about ticks, please see hel_PadGetTicks.
[in] | Buttons | Button(s) to set the repeat rate for. Must be one or a combination of the PAD_BUTTON_* defines. |
[in] | Ticks | Ticks that have to elapse until a button pressed state gets triggered. To turn off repeat rate, pass 0 (zero). |