1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META http-equiv="Content-Style-Type" content="text/css"> 6<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 7<title>KPADStatus (KPADOld)</title> 8</head> 9 10<body> 11 12<h1>KPADStatus</h1> 13 14<H2>Syntax</H2> 15<dl><dd><pre class="construction"> 16#include <revolution/kpadOld.h> 17 18typedef struct { 19 u32 hold ; 20 u32 trig ; 21 u32 release ; 22 23 Vec acc ; 24 f32 acc_value ; 25 f32 acc_speed ; 26 27 Vec2 pos ; 28 Vec2 vec ; 29 f32 speed ; 30 31 Vec2 horizon ; 32 Vec2 hori_vec ; 33 f32 hori_speed ; 34 35 f32 dist ; 36 f32 dist_vec ; 37 f32 dist_speed ; 38 39 Vec2 acc_vertical ; 40 41 u32 dev_type ; 42 43 KPADEXStatus ex_status ; 44 45 s8 dpd_valid_fg ; 46 s8 wpad_err ; 47} KPADStatus ; 48</pre></dd></dl> 49 50<H2>Elements</H2> 51<TABLE class="arguments" border="1" > 52 <TBODY> 53 <tr> 54<TH>hold</TH> 55<TD>The flag is enabled while the button is pressed.</TD> 56 </tr> 57 <tr> 58<TH>trig</TH> 59<TD>The flag is enabled only for the instant the button is pressed.</TD> 60 </tr> 61 <tr> 62<TH>release</TH> 63<TD>The flag is enabled only for the instant the button is released.</TD> 64 </tr> 65 <tr> 66<TH>acc</TH> 67<TD>Acceleration sensor value. Note the coordinate system. In contrast to the WPAD library, when the Wii Remote is pointed toward the TV screen, the forward direction is Z+, upward direction is Y+, and leftward direction is X+.</TD> 68 </tr> 69 <tr> 70<TH>acc_value</TH> 71<TD>Magnitude of acceleration (length of x, y, and z).</TD> 72 </tr> 73 <tr> 74<TH>acc_speed</TH> 75<TD>Change in acceleration (length of the difference along the x-, y-, and z-axes relative to the previous values).</TD> 76 </tr> 77 <tr> 78<TH>pos</TH> 79<TD>Pointing position. Forward is zero. Down and right are the positive directions.</TD> 80 </tr> 81 <tr> 82<TH>vec</TH> 83<TD>Difference from the previous pointing position.</TD> 84 </tr> 85 <tr> 86<TH>speed</TH> 87<TD>Length of difference from the previous pointing position.</TD> 88 </tr> 89 <tr> 90<TH>horizon</TH> 91<TD>Directional vector of the pointer's horizontal plane. The vector has a magnitude of 1, and the positive directions are to the right and down.</TD> 92 </tr> 93 <tr> 94<TH>hori_vec</TH> 95<TD>Difference from the previous directional vector.</TD> 96 </tr> 97 <tr> 98<TH>hori_speed</TH> 99<TD>Magnitude of difference from the previous directional vector.</TD> 100 </tr> 101 <tr> 102<TH>dist</TH> 103<TD>Distance between the Sensor Bar, set on the TV, and the Wii Remote. The unit is meter.</TD> 104 </tr> 105 <tr> 106<TH>dist_vec</TH> 107<TD>Difference from previous distance data.</TD> 108 </tr> 109 <tr> 110<TH>dist_speed</TH> 111<TD>Magnitude of the difference from previous distance data.</TD> 112 </tr> 113 <tr> 114<TH>acc_vertical</TH> 115<TD>The top-bottom orientation of the Wii Remote as obtained from the accelerometer. When the remote is facing forward, the result for this 2D vector of length 1 is (1,0). Coordinate x is always positive, never negative. When y is positive, the Wii Remote is facing upward; when negative, it is facing downward. This variable is not reflected in the play radius and sensitivity settings for KPAD.</TD> 116 </tr> 117 <tr> 118<TH>dev_type</TH> 119<TD>Controller type (<CODE>WPAD_DEV_*</CODE>). For details, see the <a href="../wpad/WPADStatus.html"><CODE>WPADStatus</CODE></a> structure page.</TD> 120 </tr> 121 <tr> 122<TH>ex_status</TH> 123<TD>The <a href="KPADEXStatus.html"><CODE>KPADEXStatus</CODE></a> union that maintains the expanded controller information. Programmers must access this union based on the value of <SPAN class="argument">dev_type</SPAN>.</TD> 124 </tr> 125 <tr> 126<TH>dpd_valid_fg</TH> 127<TD>Maintains the number of objects that were used to recognize the pointing position. It is normally 1 or 2; 0 indicates an invalid position. A stored negative value indicates that the recognition result is not very reliable.</TD> 128 </tr> 129 <tr> 130<TH>wpad_err</TH> 131<TD>The <a href="../wpad/WPADStatus.html"><CODE>WPADStatus</CODE></a> structure error code.</TD> 132 </tr> 133 </TBODY> 134</TABLE> 135 136<h2>Description</h2> 137<p> 138This structure stores the controller information obtained with the <a href="./KPADRead.html"><CODE>KPADRead</CODE></a> function. The element <SPAN class="argument">pos</SPAN> stores a value in the range of about -1 to +1, in which objects can be captured by the pointer. (Values whose absolute exceeds 1 may also be output.) For example, to use the screen coordinate environment where (0,0) is the screen center and 600 is the screen width, multiply this value by 300. <SPAN class="argument">dpd_valid_fg</SPAN> indicates whether or not the pointer information was calculated correctly. If this value is not zero, the calculations have completed; however, if the value is not 2, the calculations are unreliable. It may be better not to handle a negative value as valid, especially in the environment whose light source is other than a normal object. Button information and acceleration information are unrelated to this value. Their validity can be determined with <SPAN class="argument">wpad_err</SPAN> alone.<br> 139 140<ul> 141<li>Button Input</li> 142</ul> 143<blockquote> 144Button inputs are defined with the following macro constants. The digital buttons +Control Pad, A, B, 1, 2, + (plus), - (minus), and HOME are located on the Wii Remote. The digital buttons Z and C are located on the Nunchuk. 145<TABLE class="arguments" border="1" > 146<TR><TH>KPAD_BUTTON_UP</TH> <TD>+Control Pad UP is being pressed.</TD></TR> 147<TR><TH>KPAD_BUTTON_DOWN</TH> <TD>+Control Pad DOWN is being pressed.</TD></TR> 148<TR><TH>KPAD_BUTTON_LEFT</TH> <TD>+Control Pad LEFT is being pressed.</TD></TR> 149<TR><TH>KPAD_BUTTON_RIGHT</TH> <TD>+Control Pad RIGHT is being pressed.</TD></TR> 150<TR><TH>KPAD_BUTTON_A</TH> <TD>A Button is being pressed.</TD></TR> 151<TR><TH>KPAD_BUTTON_B</TH> <TD>B Button is being pressed.</TD></TR> 152<TR><TH>KPAD_BUTTON_HOME</TH> <TD>HOME is being pressed.</TD></TR> 153<TR><TH>KPAD_BUTTON_PLUS_</TH> <TD>+ Button is being pressed.</TD></TR> 154<TR><TH>KPAD_BUTTON_MINUS</TH> <TD>- Button is being pressed.</TD></TR> 155<TR><TH>KPAD_BUTTON_1</TH> <TD>1 Button is being pressed.</TD></TR> 156<TR><TH>KPAD_BUTTON_2</TH> <TD>2 Button is being pressed.</TD></TR> 157<TR><TH>KPAD_BUTTON_Z</TH> <TD>The Nunchuk's Z Button is being pressed.</TD></TR> 158<TR><TH>KPAD_BUTTON_C</TH> <TD>The Nunchuk's C Button is being pressed.</TD></TR> 159</table> 160<font color="ff0000"><B>Note:</B> The number and layout of the buttons on the Wii Remote are subject to change.</font><br><br> 161 162The following macro constants are used with UI Tool version 3 and earlier: 163<TABLE class="arguments" border="1" > 164<TR><TH>KPAD_BUTTON_SMALL_A</TH><TD>1 Button is being pressed.</TD></TR> 165<TR><TH>KPAD_BUTTON_SMALL_B</TH><TD>2 Button is being pressed.</TD></TR> 166<TR><TH>KPAD_BUTTON_SELECT</TH> <TD>SELECT is being pressed.</TD></TR> 167<TR><TH>KPAD_BUTTON_START</TH> <TD>START is being pressed.</TD></TR> 168<TR><TH>KPAD_BUTTON_Z1</TH> <TD>The Nunchuk's Z Button is being pressed.</TD></TR> 169<TR><TH>KPAD_BUTTON_Z2</TH> <TD>The Nunchuk's C Button is being pressed.</TD></TR> 170</table> 171<br> 172 173Macros that correspond to the input of the Nintendo GameCube standard controller button are defined as follows: 174<TABLE class="arguments" border="1" > 175<TR><TH>KPAD_GC_BUTTON_UP</TH> <TD>UP is being pressed on the +Control Pad. </TD></TR> 176<TR><TH>KPAD_GC_BUTTON_DOWN</TH> <TD>DOWN is being pressed on the +Control Pad. </TD></TR> 177<TR><TH>KPAD_GC_BUTTON_LEFT</TH> <TD>LEFT is being pressed on the +Control Pad. </TD></TR> 178<TR><TH>KPAD_GC_BUTTON_RIGHT</TH> <TD>RIGHT is being pressed on the +Control Pad. </TD></TR> 179<TR><TH>KPAD_GC_BUTTON_A</TH> <TD>A Button is being pressed on the +Control Pad. </TD></TR> 180<TR><TH>KPAD_GC_BUTTON_B</TH> <TD>B Button is being pressed on the +Control Pad. </TD></TR> 181<TR><TH>KPAD_GC_BUTTON_X</TH> <TD>X Button is being pressed on the +Control Pad. </TD></TR> 182<TR><TH>KPAD_GC_BUTTON_Y</TH> <TD>Y Button is being pressed on the +Control Pad. </TD></TR> 183<TR><TH>KPAD_GC_BUTTON_Z, KPAD_GC_TRIGGER_Z</TH><TD>Z Button is being pressed on the +Control Pad. </TD></TR> 184<TR><TH>KPAD_GC_BUTTON_START</TH> <TD>START/PAUSE button is being pressed on the +Control Pad.</TD></TR> 185<TR><TH>KPAD_GC_TRIGGER_R, KPAD_GC_BUTTON_R</TH><TD>R Button is being pressed on the +Control Pad.</TD></TR> 186<TR><TH>KPAD_GC_TRIGGER_L, KPAD_GC_BUTTON_L</TH><TD>L Button is being pressed on the +Control Pad.</TD></TR> 187</table> 188<br> 189 190The macros that correspond to the input from a Classic Controller button are defined as follows: 191<TABLE class="arguments" border="1" > 192<TR><TH> KPAD_CL_BUTTON_UP</TH> <TD>+Control Pad UP is being pressed.</TD></TR> 193<TR><TH> KPAD_CL_BUTTON_DOWN</TH> <TD>+Control Pad DOWN is being pressed.</TD></TR> 194<TR><TH> KPAD_CL_BUTTON_LEFT</TH> <TD>+Control Pad LEFT is being pressed.</TD></TR> 195<TR><TH> KPAD_CL_BUTTON_RIGHT</TH><TD>+Control Pad RIGHT is being pressed.</TD></TR> 196<TR><TH> KPAD_CL_BUTTON_A</TH> <TD>A Button is being pressed.</TD></TR> 197<TR><TH> KPAD_CL_BUTTON_B</TH> <TD>B Button is being pressed.</TD></TR> 198<TR><TH> KPAD_CL_BUTTON_X</TH> <TD>X Button is being pressed.</TD></TR> 199<TR><TH> KPAD_CL_BUTTON_Y</TH> <TD>Y Button is being pressed.</TD></TR> 200<TR><TH> KPAD_CL_BUTTON_PLUS</TH> <TD>+/START Button is being pressed.</TD></TR> 201<TR><TH> KPAD_CL_BUTTON_HOME</TH> <TD>HOME is being pressed.</TD></TR> 202<TR><TH> KPAD_CL_BUTTON_MINUS</TH><TD>-/SELECT Button is being pressed.</TD></TR> 203<TR><TH> KPAD_CL_TRIGGER_L</TH> <TD>L Button is being pressed.</TD></TR> 204<TR><TH> KPAD_CL_TRIGGER_R</TH> <TD>R Button is being pressed.</TD></TR> 205<TR><TH> KPAD_CL_TRIGGER_ZL</TH> <TD>ZL Button is being pressed.</TD></TR> 206<TR><TH> KPAD_CL_TRIGGER_ZR</TH> <TD>ZR Button is being pressed.</TD></TR> 207</table> 208</blockquote> 209 210<ul> 211<li>Error Code</li> 212</ul> 213<blockquote> 214For details on the error codes, see <I>WPAD Library Manual</I>. 215</blockquote> 216 217</p> 218 219<H2>See Also</H2> 220<p class="reference"> 221<a href="./KPADRead.html">KPADRead</a> 222</p> 223 224<H2>Revision History</H2> 225<P> 2262006/10/25 Changed the name to KPADOld library, beginning with Revolution SDK 2.3.<br>2006/08/xx Added the description of the <SPAN class="argument">acc_vertical</SPAN> member variable of the <CODE>KPADStatus</CODE> structure.<br>2006/08/xx Changed some macro contents that correspond to the buttons on the Wii Remote and Nunchuk. <br>2006/08/xx Added macro constants for the Classic Controller.<br>2006/06/19 Changed tentative product name to official name.<br>2006/03/01 Initial version.<br> 227</P> 228 229<hr><p>CONFIDENTIAL</p></body> 230</HTML> 231