libnx
v4.7.0
|
Simple wrapper for the HID Npad API. More...
Go to the source code of this file.
Data Structures | |
struct | PadState |
Pad state object. More... | |
struct | PadRepeater |
Pad button repeater state object. More... | |
Macros | |
#define | PAD_ANY_ID_MASK 0x1000100FFUL |
Mask including all existing controller IDs. | |
#define | padInitialize(_pad, ...) |
Initializes a PadState object to read input from one or more controller input sources. More... | |
Functions | |
void | padConfigureInput (u32 max_players, u32 style_set) |
Configures the input layout supported by the application. More... | |
void | padInitializeWithMask (PadState *pad, u64 mask) |
Same as padInitialize, but taking a bitfield of controller IDs directly. More... | |
static void | padInitializeAny (PadState *pad) |
Same as padInitialize, but including every single controller input source. More... | |
static void | padInitializeDefault (PadState *pad) |
Same as padInitialize, but including HidNpadIdType_No1 and HidNpadIdType_Handheld. More... | |
void | padUpdate (PadState *pad) |
Updates pad state by reading from the controller input sources specified during initialization. More... | |
static bool | padIsHandheld (const PadState *pad) |
Retrieves whether HidNpadIdType_Handheld is an active input source (i.e. More... | |
static bool | padIsNpadActive (const PadState *pad, HidNpadIdType id) |
Retrieves whether the specified controller is an active input source (i.e. More... | |
static u32 | padGetStyleSet (const PadState *pad) |
Retrieves the set of input styles supported by the selected controller input sources. More... | |
static u32 | padGetAttributes (const PadState *pad) |
Retrieves the set of attributes reported by the system for the selected controller input sources. More... | |
static bool | padIsConnected (const PadState *pad) |
Retrieves whether any of the selected controller input sources is connected. More... | |
static u64 | padGetButtons (const PadState *pad) |
Retrieves the current set of pressed buttons across all selected controller input sources. More... | |
static u64 | padGetButtonsDown (const PadState *pad) |
Retrieves the set of buttons that are newly pressed. More... | |
static u64 | padGetButtonsUp (const PadState *pad) |
Retrieves the set of buttons that are newly released. More... | |
static HidAnalogStickState | padGetStickPos (const PadState *pad, unsigned i) |
Retrieves the position of an analog stick in a controller. More... | |
static u32 | padGetGcTriggerPos (const PadState *pad, unsigned i) |
Retrieves the position of an analog trigger in a GameCube controller. More... | |
static void | padRepeaterInitialize (PadRepeater *r, u16 delay, u16 repeat) |
Initializes a PadRepeater object with the specified settings. More... | |
void | padRepeaterUpdate (PadRepeater *r, u64 button_mask) |
Updates pad repeat state. More... | |
static u64 | padRepeaterGetButtons (const PadRepeater *r) |
Retrieves the set of buttons that are being repeated according to the parameters specified in padRepeaterInitialize. More... | |
Simple wrapper for the HID Npad API.
#define padInitialize | ( | _pad, | |
... | |||
) |
Initializes a PadState object to read input from one or more controller input sources.
[in] | _pad | Pointer to PadState. |
Configures the input layout supported by the application.
[in] | max_players | The maximum supported number of players (1 to 8). |
[in] | style_set | Bitfield of supported controller styles (see HidNpadStyleTag). |
Retrieves the set of attributes reported by the system for the selected controller input sources.
[in] | pad | Pointer to PadState. |
Retrieves the current set of pressed buttons across all selected controller input sources.
[in] | pad | Pointer to PadState. |
Retrieves the set of buttons that are newly pressed.
[in] | pad | Pointer to PadState. |
Retrieves the set of buttons that are newly released.
[in] | pad | Pointer to PadState. |
Retrieves the position of an analog trigger in a GameCube controller.
[in] | pad | Pointer to PadState. |
[in] | i | ID of the analog trigger to read (0=left, 1=right). |
|
inlinestatic |
Retrieves the position of an analog stick in a controller.
[in] | pad | Pointer to PadState. |
[in] | i | ID of the analog stick to read (0=left, 1=right). |
Retrieves the set of input styles supported by the selected controller input sources.
[in] | pad | Pointer to PadState. |
|
inlinestatic |
Same as padInitialize, but including every single controller input source.
[in] | pad | Pointer to PadState. |
|
inlinestatic |
Same as padInitialize, but including HidNpadIdType_No1 and HidNpadIdType_Handheld.
[in] | pad | Pointer to PadState. |
Same as padInitialize, but taking a bitfield of controller IDs directly.
[in] | pad | Pointer to PadState. |
[in] | mask | Bitfield of controller IDs (each bit's position indicates a different HidNpadIdType value). |
|
inlinestatic |
|
inlinestatic |
Retrieves whether HidNpadIdType_Handheld is an active input source (i.e.
it was possible to read from it).
[in] | pad | Pointer to PadState. |
|
inlinestatic |
Retrieves whether the specified controller is an active input source (i.e.
it was possible to read from it).
[in] | pad | Pointer to PadState. |
[in] | id | ID of the controller input source (see HidNpadIdType) |
|
inlinestatic |
Retrieves the set of buttons that are being repeated according to the parameters specified in padRepeaterInitialize.
[in] | r | Pointer to PadRepeater. |
|
inlinestatic |
Initializes a PadRepeater object with the specified settings.
[in] | r | Pointer to PadRepeater. |
[in] | delay | Number of input updates between button presses being first detected and them being considered for repeat. |
[in] | repeat | Number of input updates between autogenerated repeat button presses. |
void padRepeaterUpdate | ( | PadRepeater * | r, |
u64 | button_mask | ||
) |
Updates pad repeat state.
[in] | r | Pointer to PadRepeater. |
[in] | button_mask | Bitfield of currently pressed HidNpadButton that will be considered for repeat. |