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<h1>KPADStatus</h1> 13 14<H2>Syntax</H2> 15<dl><dd><pre class="construction"> 16#include <revolution/kpad.h> 17 18typedef struct KPADStatus{ 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 u8 dev_type ; 42 s8 wpad_err ; 43 s8 dpd_valid_fg ; 44 u8 data_format ; 45 46 KPADEXStatus ex_status ; 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>wpad_err</TH> 123<TD>Error status of the <a href="../wpad/WPADStatus.html"><CODE>WPADStatus</CODE></a> structure.</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>data_format</TH> 131<TD>The return value of <a href="../wpad/WPADGetDataFormat.html"><CODE>WPADGetDataFormat</CODE></a> is stored in a <code>u8</code> type.</TD> 132 </tr> 133 <tr> 134<TH>ex_status</TH> 135<TD>The <a href="KPADEXStatus.html"><CODE>KPADEXStatus</CODE></a> union that maintains the expanded controller information. Access this union using the <SPAN class="argument">wpad_err</SPAN>, <SPAN class="argument">dev_type</SPAN>, and <SPAN class="argument">data_format</SPAN> values.</TD> 136 </tr> 137 </TBODY> 138</TABLE> 139 140<h2>Description</h2> 141<p> 142This structure stores the controller information obtained with the <a href="./KPADRead.html"><CODE>KPADRead</CODE></a> function. The <SPAN class="argument">pos</SPAN> element stores values in the range of about -1 to +1; in this range, 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. The effectiveness of the button and acceleration information may be determined based on <font color="#ff0000"><SPAN class="argument">wpad_err</SPAN>, <SPAN class="argument">dev_type</SPAN>, and <SPAN class="argument">data_format</SPAN> value,</font> independent of this value.<br> 143</p> 144 145<ul> 146<li>Button Input</li> 147</ul> 148<blockquote> 149Button input is 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. 150<TABLE class="arguments" border="1" > 151<TR><TH>KPAD_BUTTON_UP</TH> <TD>+Control Pad UP is being pressed.</TD></TR> 152<TR><TH>KPAD_BUTTON_DOWN</TH> <TD>+Control Pad DOWN is being pressed.</TD></TR> 153<TR><TH>KPAD_BUTTON_LEFT</TH> <TD>+Control Pad LEFT is being pressed.</TD></TR> 154<TR><TH>KPAD_BUTTON_RIGHT</TH> <TD>+Control Pad RIGHT is being pressed.</TD></TR> 155<TR><TH>KPAD_BUTTON_A</TH> <TD>A Button is being pressed.</TD></TR> 156<TR><TH>KPAD_BUTTON_B</TH> <TD>B Button is being pressed.</TD></TR> 157<TR><TH>KPAD_BUTTON_HOME</TH> <TD>HOME is being pressed.</TD></TR> 158<TR><TH>KPAD_BUTTON_PLUS</TH> <TD>+ Button is being pressed.</TD></TR> 159<TR><TH>KPAD_BUTTON_MINUS</TH> <TD>- Button is being pressed.</TD></TR> 160<TR><TH>KPAD_BUTTON_1</TH> <TD>1 Button is being pressed.</TD></TR> 161<TR><TH>KPAD_BUTTON_2</TH> <TD>2 Button is being pressed.</TD></TR> 162<TR><TH>KPAD_BUTTON_Z</TH> <TD>The Nunchuk's Z Button is being pressed.</TD></TR> 163<TR><TH>KPAD_BUTTON_C</TH> <TD>The Nunchuk's C Button is being pressed.</TD></TR> 164</table> 165</blockquote> 166 167<ul> 168<li>Error Status</li> 169</ul> 170<blockquote> 171For details on the error status, see the WPAD Library Manual. 172</blockquote> 173 174<H2>See Also</H2> 175<p class="reference"> 176<a href="./KPADRead.html">KPADRead</a>, 177<a href="./KPADEXStatus.html">KPADEXStatus</a> 178</p> 179 180<H2>Revision History</H2> 181<P> 1822006/10/25 Revised the description to match KPAD version 2.<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> 183</P> 184 185<hr><p>CONFIDENTIAL</p></body> 186</HTML> 187