1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
9<title>DEMO Pad Functions</title>
10</head>
11
12<body>
13
14<h1 align="left">DEMO Pad Functions</h1>
15
16
17<h2>C Specification</h2>
18
19<dl>
20<dd><pre><CODE>#include &lt;demo.h&gt;</CODE></pre>
21  </dd>
22<dd><pre><CODE>// main function prototypes
23extern void     DEMOPadInit( void );
24extern void     DEMOPadRead( void );
25
26// inline functions for getting each component
27inline u16 DEMOPadGetButton(u32 i);
28inline u16 DEMOPadGetButtonUp(u32 i);
29inline u16 DEMOPadGetButtonDown(u32 i);
30inline u16 DEMOPadGetDirs(u32 i);
31inline u16 DEMOPadGetDirsNew(u32 i);
32inline u16 DEMOPadGetDirsReleased(u32 i);
33inline s8  DEMOPadGetStickX(u32 i);
34inline s8  DEMOPadGetStickY(u32 i);
35inline s8  DEMOPadGetSubStickX(u32 i);
36inline s8  DEMOPadGetSubStickY(u32 i);
37inline u8  DEMOPadGetTriggerL(u32 i);
38inline u8  DEMOPadGetTriggerR(u32 i);
39inline u8  DEMOPadGetAnalogA(u32 i);
40inline u8  DEMOPadGetAnalogB(u32 i);
41inline s8  DEMOPadGetErr(u32 i);</CODE></pre>
42  </dd>
43</dl>
44
45<h2>Arguments</h2>
46<TABLE border="1" cellpadding="3" cellspacing="0.1">
47  <tr>
48<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>i</CODE></strong></em></TD>
49<TD width="520">Specifies Controller to read. The first Controller is 0, the second Controller is 1, etc.</TD>
50    </tr>
51</TABLE>
52<h2>Return Values</h2>
53<TABLE border="1" cellpadding="3" cellspacing="0.1">
54  <tr>
55<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>u16 (button)</CODE></strong></em></TD>
56<TD width="520">Bit field that indicates the button state. Refer to <CODE>&lt;revolution/pad.h&gt;</CODE> for bit field names.</TD>
57    </tr>
58  <tr>
59<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>u16 (dir)</CODE></strong></em></TD>
60<TD width="520">Bit field that specifies the directional state of the stick. Refer to <CODE>&lt;demo.h&gt;</CODE> for bit field names.</TD>
61    </tr>
62  <tr>
63<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>s8&nbsp; (stick)</CODE></strong></em></TD>
64      <TD width="520">
65Analog value for the stick position.</TD>
66    </tr>
67  <tr>
68<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>u8</CODE></strong></em></TD>
69<TD width="520">Analog value that indicates how long the trigger or analog button has been pressed.</TD>
70    </tr>
71  <tr>
72<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>s8&nbsp; (DEMOPadGetErr)</CODE></strong></em></TD>
73<TD width="520">A <CODE>PAD_ERR*</CODE> value specified in <CODE>&lt;revolution/pad.h&gt;</CODE>.</TD>
74    </tr>
75</TABLE>
76<H2>Description</H2>
77<P>The DEMO Pad library provides a means for reading Controller input.&nbsp;</P>
78<P>The <code>DEMOPadInit</code> function initializes the DEMO Pad system.</P>
79<P>The <code>DEMOPadRead</code> 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.</P>
80<P>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 <CODE>&lt;revolution/pad.h&gt;</CODE>. The direction-related functions return a different bit field that is defined in <CODE>&lt;demo.h&gt;</CODE>. For these functions, the stick input is digitized into primary directions (up, down, left, right).</P>
81<H3>Example Program</H3>
82<P>TBD.</P>
83
84
85
86<h2>See Also</h2>
87
88<p><a target="contents" href="../pad/toc.html">Controller</a></p>
89<H2>Revision History</H2>
90<P>03/01/2006 Initial version.</P>
91</body>
92</html>