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