DEMO Pad Functions

Syntax

#include <demo.h>

// main function prototypes
extern void     DEMOPadInit( void );
extern void     DEMOPadRead( void );

// inline functions for getting each component
inline u16 DEMOPadGetButton(u32 i);
inline u16 DEMOPadGetButtonUp(u32 i);
inline u16 DEMOPadGetButtonDown(u32 i);
inline u16 DEMOPadGetDirs(u32 i);
inline u16 DEMOPadGetDirsNew(u32 i);
inline u16 DEMOPadGetDirsReleased(u32 i);
inline s8  DEMOPadGetStickX(u32 i);
inline s8  DEMOPadGetStickY(u32 i);
inline s8  DEMOPadGetSubStickX(u32 i);
inline s8  DEMOPadGetSubStickY(u32 i);
inline u8  DEMOPadGetTriggerL(u32 i);
inline u8  DEMOPadGetTriggerR(u32 i);
inline u8  DEMOPadGetAnalogA(u32 i);
inline u8  DEMOPadGetAnalogB(u32 i);
inline s8  DEMOPadGetErr(u32 i);

Arguments

i Specifies Controller to read. The first Controller is 0, the second Controller is 1, etc.

Return Values

u16 (button) Bit field that indicates the button state. Refer to <revolution/pad.h> for bit field names.
u16 (dir) Bit field that specifies the directional state of the stick. Refer to <demo.h> for bit field names.
s8  (stick) Analog value for the stick position.
u8 Analog value that indicates how long the trigger or analog button has been pressed.
s8  (DEMOPadGetErr) <A PAD_ERR* value specified in <revolution/pad.h>.

Description

The DEMO Pad library provides a means for reading Controller input. 

The DEMOPadInit function initializes the DEMO Pad system.

The DEMOPadRead function is used to sample the current complete set of Controller inputs. Once a sample has been read, the individual values can be examined using inline functions.

The inline functions return the state of the various Controller inputs. Each function takes an argument that specifies the Controller to be examined: the first Controller is 0, the second Controller is 1, etc. Some functions represent only the current Controller state, while others specify whether there are any transitions between the current and past sample. The button-related functions return a bit field with a bit that specifies each button state (not active = 0, active = 1). The fields are defined in <revolution/pad.h>. The direction-related functions return a different bit field that is defined in <demo.h>. For these functions, the stick input is digitized into primary directions (up, down, left, right).

Example Program

(TBA)

See Also

GameCube Controller (PAD)

Revision History

2006/03/01 Initial version.


CONFIDENTIAL