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=utf-8"> 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 48 KPADMPStatus mpls ; 49 50 u8 __paddings__[ 4 ] ; 51 52} KPADStatus ; 53</pre></dd></dl> 54 55<H2>Elements</H2> 56<TABLE class="arguments" border="1" > 57 <TBODY> 58 <tr> 59<TH>hold</TH> 60<TD>The flag is enabled while the button is pressed.</TD> 61 </tr> 62 <tr> 63<TH>trig</TH> 64<TD>The flag is enabled only for the instant the button is pressed.</TD> 65 </tr> 66 <tr> 67<TH>release</TH> 68<TD>The flag is enabled only for the instant the button is released.</TD> 69 </tr> 70 <tr> 71<TH>acc</TH> 72<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> 73 </tr> 74 <tr> 75<TH>acc_value</TH> 76<TD>Magnitude of acceleration (length of x, y, and z).</TD> 77 </tr> 78 <tr> 79<TH>acc_speed</TH> 80<TD>Change in acceleration (length of the difference along the x-, y-, and z-axes relative to the previous values).</TD> 81 </tr> 82 <tr> 83<TH>pos</TH> 84<TD>Pointing position: Forward is zero; down and right are the positive directions.</TD> 85 </tr> 86 <tr> 87<TH>vec</TH> 88<TD>Difference from the previous pointing position.</TD> 89 </tr> 90 <tr> 91<TH>speed</TH> 92<TD>Length of difference from the previous pointing position.</TD> 93 </tr> 94 <tr> 95<TH>horizon</TH> 96<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> 97 </tr> 98 <tr> 99<TH>hori_vec</TH> 100<TD>Difference from the previous directional vector.</TD> 101 </tr> 102 <tr> 103<TH>hori_speed</TH> 104<TD>Magnitude of difference from the previous directional vector.</TD> 105 </tr> 106 <tr> 107<TH>dist</TH> 108<TD>Distance between the Sensor Bar, set on the TV, and the Wii Remote. The unit is meter.</TD> 109 </tr> 110 <tr> 111<TH>dist_vec</TH> 112<TD>Difference from previous distance data.</TD> 113 </tr> 114 <tr> 115<TH>dist_speed</TH> 116<TD>Magnitude of the difference from previous distance data.</TD> 117 </tr> 118 <tr> 119<TH>acc_vertical</TH> 120<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> 121 </tr> 122 <tr> 123<TH>dev_type</TH> 124<TD>Controller type (<CODE>WPAD_DEV_*</CODE>). For details, see the <a href="../wpad/WPADStatus.html"><CODE>WPADStatus</CODE></a> structure page.</TD> 125 </tr> 126 <tr> 127<TH>wpad_err</TH> 128<TD>Error status of the <a href="../wpad/WPADStatus.html"><CODE>WPADStatus</CODE></a> structure.</TD> 129 </tr> 130 <tr> 131<TH>dpd_valid_fg</TH> 132<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> 133 </tr> 134 <tr> 135<TH>data_format</TH> 136<TD>The return value of <a href="../wpad/WPADGetDataFormat.html"><CODE>WPADGetDataFormat</CODE></a> is stored in a <code>u8</code> type.</TD> 137 </tr> 138 <tr> 139<TH>ex_status</TH> 140<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> 141 </tr> 142 <tr> 143<TH>mpls</TH> 144<TD><a href="./KPADMPStatus.html"><code>KPADMPStatus</code></a> structure stores Wii MotionPlus information. This structure is updated only while a work area has been set using the <a href="./KPADSetMplsWorkarea.html"><code>KPADSetMplsWorkarea</code></a> function.</TD> 145 </tr> 146 </TBODY> 147</TABLE> 148 149<h2>Description</h2> 150<p> 151This 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> 152</p> 153 154<ul> 155<li>Button Input</li> 156</ul> 157<blockquote> 158Button 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. 159<TABLE class="arguments" border="1" > 160<TR><TH>KPAD_BUTTON_UP</TH> <TD>+Control Pad UP is being pressed.</TD></TR> 161<TR><TH>KPAD_BUTTON_DOWN</TH> <TD>+Control Pad DOWN is being pressed.</TD></TR> 162<TR><TH>KPAD_BUTTON_LEFT</TH> <TD>+Control Pad LEFT is being pressed.</TD></TR> 163<TR><TH>KPAD_BUTTON_RIGHT</TH> <TD>+Control Pad RIGHT is being pressed.</TD></TR> 164<TR><TH>KPAD_BUTTON_A</TH> <TD>A Button is being pressed.</TD></TR> 165<TR><TH>KPAD_BUTTON_B</TH> <TD>B Button is being pressed.</TD></TR> 166<TR><TH>KPAD_BUTTON_HOME</TH> <TD>HOME is being pressed.</TD></TR> 167<TR><TH>KPAD_BUTTON_PLUS</TH> <TD>+ Button is being pressed.</TD></TR> 168<TR><TH>KPAD_BUTTON_MINUS</TH> <TD>- Button is being pressed.</TD></TR> 169<TR><TH>KPAD_BUTTON_1</TH> <TD>1 Button is being pressed.</TD></TR> 170<TR><TH>KPAD_BUTTON_2</TH> <TD>2 Button is being pressed.</TD></TR> 171<TR><TH>KPAD_BUTTON_Z</TH> <TD>The Nunchuk's Z Button is being pressed.</TD></TR> 172<TR><TH>KPAD_BUTTON_C</TH> <TD>The Nunchuk's C Button is being pressed.</TD></TR> 173</table> 174</blockquote> 175 176<ul> 177<li>Error Status</li> 178</ul> 179<blockquote> 180For details on the error status, see the WPAD Library Manual. 181</blockquote> 182 183<H2>See Also</H2> 184<p class="reference"> 185<a href="./KPADRead.html"><CODE>KPADRead</CODE></a><BR> <a href="./KPADEXStatus.html"><CODE>KPADEXStatus</CODE></a><BR> <a href="./KPADMPStatus.html"><CODE>KPADMPStatus</CODE></a> 186</p> 187 188<H2>Revision History</H2> 189<P> 1902008/12/04 Changed the <SPAN class="argument">mpls</SPAN> member from <code>Vec</code> type to the <code>KPADMPStatus</code> structure.<br> 2008/09/30 Explained the Wii MotionPlus.<br>2006/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> 191</P> 192 193<hr><p>CONFIDENTIAL</p></body> 194</HTML> 195