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</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/kpad.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 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 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 Control 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 DPD'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. (1,0) results for this 2D vector of length 1 when the remote is facing forward. 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><CODE>pos</CODE> stores a value of the range in which objects can be captured by the DPD 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 DPD 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, a, b, SELECT, START, and HOME are located on the Wii Remote Control. The digital buttons Z and C are located on the Nunchaku unit. 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_SMALL_A</CODE></TD><TD>The 1 Button is being pressed.</TD></TR> 160<TR><TD width="150"><CODE>KPAD_BUTTON_SMALL_B</CODE></TD><TD>The 2 Button is being pressed.</TD></TR> 161<TR><TD width="150"><CODE>KPAD_BUTTON_SELECT</CODE></TD> <TD>BACK is being pressed.</TD></TR> 162<TR><TD width="150"><CODE>KPAD_BUTTON_START</CODE></TD> <TD>PAUSE is being pressed.</TD></TR> 163<TR><TD width="150"><CODE>KPAD_BUTTON_HOME</CODE></TD> <TD>HOME is being pressed.</TD></TR> 164<TR><TD width="150"><CODE>KPAD_BUTTON_Z1</CODE></TD> <TD>The Z Button on the Nunchaku Controller is being pressed.</TD></TR> 165<TR><TD width="150"><CODE>KPAD_BUTTON_Z2</CODE></TD> <TD>The C Button on the Nunchaku Controller 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. 168</font><br><br> 169Macros corresponding to Nintendo GameCube standard controller button input are defined as follows. 170<table border="1"> 171<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> 172<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> 173<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> 174<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> 175<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> 176<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> 177<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> 178<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> 179<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> 180<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> 181<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> 182<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> 183</table> 184</blockquote> 185 186<ul> 187<li>Error Codes</li> 188</ul> 189For details on the error codes, see the WPAD Library Manual. 190</p> 191 192<H2>See Also</H2> 193 194<H2>Revision History</H2> 195<P> 19603/01/2006 Initial version. <BR>06/19/2006 Changed tentative product name to official name.<BR>8/xx/2006 Added a description of the acc_vertical member variable of the xx KPADStatus structure.<br> 197</P> 198 199<hr> 200<P>CONFIDENTIAL</p> 201</BODY> 202</HTML> 203