PageRenderTime 34ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Help/GiiMote Help/GiiMote.htm

https://code.google.com/p/giimote/
HTML | 380 lines | 370 code | 9 blank | 1 comment | 0 complexity | cf6e02e2d1453d75d83725ff7c646e3b MD5 | raw file
Possible License(s): AGPL-3.0, CC-BY-SA-3.0, GPL-3.0, LGPL-3.0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>GiiMote Help</title>
  5. <link href="style.css" rel="stylesheet" type="text/css">
  6. </head>
  7. <body background="back.gif">
  8. <!--START-->
  9. <h1><a name="GiiMote">GiiMote</a></h1>
  10. <p>
  11. This package allows Game Maker to read and write state information to and from a Nintendo Wii Remote (unofficially, &quot;Wiimote&quot;) connected wirelessly via a Bluetooth connection. For this extension to work you will need the latest version of the Microsoft .NET Framework installed on your computer.
  12. <p>To use this package in a game, select the item <b>Select Extension Packages</b> in the
  13. <b>Resources</b> menu. In the form that appears
  14. click on the <b>GiiMote</b> item in the right list and press the button to
  15. move it to the left list.</p>
  16. <h2><a name="Connecting">Connecting the Wii Remote</a></h2>
  17. <p>Before the Wii Remote can be used in your game it must be connected to the computer wirelessly via Bluetooth. This is much easier said than done. The Wii Remote will not pair successfully with every Bluetooth device or stack so make sure your device and stack are compatible.<br>
  18. To pair your Wii Remote with your computer follow these steps:</p>
  19. <ol>
  20. <li>Start your Bluetooth software and search for devices.</li>
  21. <li>Hold down the 1 and 2 buttons on the bottom of the Wii Remote (Or press the Sync button under the battery case if you don't mind losing the pairing with your Wii). The blue LED's should start to flash. Hold these buttons until the process is complete.</li>
  22. <li>If all is well the Wii Remote should show up in the device list as <b>Nintendo RVL-CNT-01</b>. If not, start the process over.</li>
  23. <li>Follow the directions given by your Bluetooth software.</li>
  24. <li>If you are asked to supply a password or PIN number press skip or leave this value blank.</li>
  25. <li>If you are asked which service to use for the Wii Remote select the keyboard/mouse/HID service.</li>
  26. </ol>
  27. <p>
  28. <h2><a name="setup">Setting Up and Tearing Down GiiMote</a></h2>
  29. <p>Once we have our Wii Remote(s) paired successfully with our computer, we can use them in our game. To check if any Wii Remotes are paired correctly you may call the function <b><a name="wm_find_all">wm_find_all()</a></b>.
  30. After you have found all of the paired Wii Remotes you may use the function <b><a name="wm_found">wm_found()</a></b> to
  31. see how many Wii Remotes are currently recognized by the system. Just because a Wii Remote is found does not mean it is currently available for connecting, to see if the current Wii Remote is
  32. available you may call <b><a name="wm_exists">wm_exists()</a></b>. To check the current number of
  33. available Wii Remotes you can use <b><a name="wm_num_exists">wm_num_exists()</a></b>.
  34. To change the active Wii
  35. Remote you may call the function <b><a name="wm_set_using">wm_set_using(wm)</a></b> where wm is the index, id, or guid of the Wii Remote to use for future function calls.
  36. Each Wii Remote attatched to the system has two unique values which may be used
  37. to identify it, the index, which may change as other Wii Remotes are
  38. disconnected, and the guid which can be expressed either as a string, or,
  39. numerically. The index is an integer between 0 and the number of connected Wii
  40. Remotes - 1, so the first Wii Remote always has an index of 0. To get the index or guid of a Wii Remote, the following functions may
  41. be used:</p>
  42. <blockquote>
  43. <tt><b><a name="wm_get_index">wm_get_index()</a></b></tt>
  44. Gets the index of the active Wii Remote.<br>
  45. <tt><b><a name="wm_get_index">wm_get_index(guid)</a></b></tt>
  46. Gets the index of the Wii Remote with the given guid.<br>
  47. <tt><b><a name="wm_get_index">wm_get_index(id)</a></b></tt>
  48. Gets the index of the Wii Remote with the given ID.<br>
  49. <tt><b><a name="wm_get_index">wm_get_guid()</a></b></tt>
  50. Gets the unique guid of the active Wii Remote as a string.<br>
  51. <tt><b><a name="wm_get_index">wm_get_guid(id)></b></tt>
  52. Gets the unique guid of the Wii Remote with the given id as a string.<br>
  53. <tt><b><a name="wm_get_id">wm_get_id()</a></b></tt>
  54. Gets the unique ID of the active Wii Remote as a real value.<br>
  55. <tt><b><a name="wm_get_id">wm_get_id(guid)></b></tt>
  56. Gets the unique ID of the Wii Remote with the given guid as a real value.<br>
  57. </blockquote>
  58. <p>It is also possible to retreive the HID device path using the function <b><a name="wm_get_hid_device_path">wm_get_hid_device_path()</a></b></p>
  59. <p>To connect to a single Wii Remote you can call <b><a name="wm_connect">wm_connect()</a></b> which will return either 1 if successful, 0 if the connection failed, or -1 if a Wii Remote is already connected. To connect all discovered Wii Remotes at once you may use <b><a name="wm_connect_all">wm_connect_all()</a></b>. When you are done using the Wii Remote
  60. you can call <b><a name="wm_disconnect">wm_disconnect()</a></b>
  61. to release the Wii Remote or <b><a name="wm_disconnect">wm_disconnect_all()</a></b> to release all connected Wii Remotes. Please note that these functions do not stop the Wii Remote(s) from being paired with your computer! You must disconnect the Wii Remote manually to stop it from using its battery power (Press the power button on the Wii Remote or disconnect via your bluetooth stack). We can also check to see if the active Wii Remote is currently connected to our application by using <b><a name="wm_connected">wm_connected()</a></b>. After the Wii Remote is connected,
  62. we can find out information about the currently plugged in extension (if any) by
  63. calling <b><a name="wm_check_extension">wm_check_extension()</a></b>. This will return one of the following constants:</p>
  64. <blockquote>
  65. <tt><b><a name="ext_classic">ext_classic</a></b></tt><br>
  66. <tt><b><a name="ext_nunchuck">ext_nunchuck</a></b></tt><br>
  67. <tt><b><a name="ext_guitar">ext_guitar</a></b></tt><br>
  68. <tt><b><a name="ext_drums">ext_drums</a></b></tt><br>
  69. <tt><b><a name="ext_balanceboard">ext_balanceboard</a></b></tt><br>
  70. <tt><b><a name="ext_none">ext_none</a></b></tt><br>
  71. <tt><b><a name="ext_unknown">ext_unknown</a></b></tt><br>
  72. </blockquote>
  73. <p>There are two types of Guitar extension for the Wii Remote. You can check which is plugged in by calling the function <b><a name="wm_guitar_get_type">wm_guitar_get_type()</a></b> which returns either 1 (Guitar Hero World Tour) or 0 (Guitar Hero 3).</p>
  74. <p>GiiMote stores data about the Wii Remote inside the extension. Anytime you set
  75. the rumble, check the battery life, or change the status of the Wii Remote in any way (by
  76. turning off an LED for instance) this data is updated and when you call a function which returns some data (wm_get_rumble for instance) it checks this data, not the Wii Remote directly. Most of the time this information is up to date, but sometimes it is still useful to update the status of the Wii Remote manually.
  77. This can be accomplished by calling <b><a name="wm_get_status">wm_get_status()</a></b>. This function sends a request to the Wii Remote which will then send back
  78. its current status. The function returns weather or not the update was
  79. a success.</p>
  80. <h2><a name="buttons">Reading Buttons</a></h2>
  81. <p>You can find the status of buttons on the Wii Remote and supported expansion controllers by calling the following functions:</p>
  82. <blockquote>
  83. <tt><b><a name="wm_check_button">wm_check_button(button)</a></b></tt>
  84. Gets the status (boolean) of the given button on the Wii Remote.<br>
  85. <tt><b><a name="wm_classic_check_button">wm_classic_check_button(button)</a></b></tt>
  86. Gets the status of the given button on the Classic Controller (if inserted).<br>
  87. <tt><b><a name="wm_nunchuck_check_button">wm_nunchuck_check_button(button)</a></b></tt>
  88. Gets the status of the given button on the Nunchuck (if inserted).<br>
  89. <tt><b><a name="wm_guitar_check_button">wm_guitar_check_button(button)</a></b></tt>
  90. Gets the status of the given button on the guitar (if inserted).<br>
  91. <tt><b><a name="wm_drum_check_button">wm_drum_check_button(button)</a></b></tt>
  92. Gets the status of the given button, head, or pedal on the drum set (if inserted).<br>
  93. </blockquote>
  94. <p>There is also an additional function for checking the pressure of L and R on the classic controller:</p>
  95. <blockquote>
  96. <p><tt><b><a name="wm_classic_trigger_pressure">wm_classic_trigger_pressure(trigger)</a></b></tt>
  97. This function returns a value between 0.0 and 1.0 depending on the amount the trigger is being pushed in with 1 being all the way in and 0 being released. You may define a &quot;dead zone&quot; for the function by calling <a href="#wm_set_dead_zone">wm_set_dead_zone</a>.</p>
  98. </blockquote>
  99. <p>Another for checking the pressure on the Whammy bar on the Guitar:</p>
  100. <blockquote>
  101. <p><tt><b><a name="wm_guitar_whammybar_pos">wm_guitar_whammybar_pos()</a></b></tt> The position of the Guitar's whammy bar as a value between 0.0 and 1.0.</p>
  102. </blockquote>
  103. <p>And another for checking the velocity with which the drum heads and pedal on the drum set are hit:</p>
  104. <blockquote>
  105. <p><tt><b><a name="wm_drum_get_velocity">wm_drum_get_velocity(head)</a></b></tt> The velocity with which the drum head or pedal was hit from 0.0 (hard) to 6.0 (soft).</p>
  106. </blockquote>
  107. <p>
  108. The following button key codes exist for use in any function that requires a button (not all buttons are available on all controllers):</p>
  109. <blockquote>
  110. <tt><b><a name="wm_a">wm_a</a></b></tt><br>
  111. <tt><b><a name="wm_b">wm_b</a></b></tt><br>
  112. <tt><b><a name="wm_up">wm_up</a></b></tt><br>
  113. <tt><b><a name="wm_down">wm_down</a></b></tt><br>
  114. <tt><b><a name="wm_left">wm_left</a></b></tt><br>
  115. <tt><b><a name="wm_right">wm_right</a></b></tt><br>
  116. <tt><b><a name="wm_one">wm_one</a></b></tt><br>
  117. <tt><b><a name="wm_two">wm_two</a></b></tt><br>
  118. <tt><b><a name="wm_plus">wm_plus</a></b></tt><br>
  119. <tt><b><a name="wm_minus">wm_minus</a></b></tt><br>
  120. <tt><b><a name="wm_home">wm_home</a></b></tt><br>
  121. <tt><b><a name="wm_x">wm_x</a></b></tt><br>
  122. <tt><b><a name="wm_y">wm_y</a></b></tt><br>
  123. <tt><b><a name="wm_l">wm_l</a></b></tt><br>
  124. <tt><b><a name="wm_r">wm_r</a></b></tt><br>
  125. <tt><b><a name="wm_zl">wm_zl</a></b></tt><br>
  126. <tt><b><a name="wm_c">wm_c</a></b></tt><br>
  127. <tt><b><a name="wm_z">wm_z</a></b></tt><br>
  128. <tt><b><a name="wm_blue">wm_blue</a></b></tt><br>
  129. <tt><b><a name="wm_green">wm_green</a></b></tt><br>
  130. <tt><b><a name="wm_orange">wm_orange</a></b></tt><br>
  131. <tt><b><a name="wm_red">wm_red</a></b></tt><br>
  132. <tt><b><a name="wm_yellow">wm_yellow</a></b></tt><br>
  133. <tt><b><a name="wm_touch_blue">wm_touch_blue</a></b></tt><br>
  134. <tt><b><a name="wm_touch_green">wm_touch_green</a></b></tt><br>
  135. <tt><b><a name="wm_touch_orange">wm_touch_orange</a></b></tt><br>
  136. <tt><b><a name="wm_touch_red">wm_touch_red</a></b></tt><br>
  137. <tt><b><a name="wm_touch_yellow">wm_touch_yellow</a></b></tt><br>
  138. <tt><b><a name="wm_strum_up">wm_strum_up</a></b></tt><br>
  139. <tt><b><a name="wm_strum_down">wm_strum_down</a></b></tt><br>
  140. <tt><b><a name="wm_pedal">wm_pedal</a></b></tt><br>
  141. </blockquote>
  142. <h2><a name="joystick">Joystick Positions</a></h2>
  143. <p>The Nunchuck, Classic Controller, Guitar controller, and Drum set both contain one or more joysticks which can be utilized with the following functions:</p>
  144. <blockquote>
  145. <tt><b><a name="wm_nunchuck_xpos">wm_nunchuck_xpos()</a></b></tt> From -0.5 (left) to 0.5 (right).<br>
  146. <tt><b><a name="wm_nunchuck_ypos">wm_nunchuck_ypos()</a></b></tt><br>
  147. <tt><b><a name="wm_nunchuck_direction">wm_nunchuck_direction()</a></b></tt> Returns a value from 0 to ?180 degrees.<br>
  148. <tt><b><a name="wm_nunchuck_pressure">wm_nunchuck_pressure()</a></b></tt> Returns the pressure on the joystick as a value between 0 and 1 disregarding direction.<br>
  149. <tt><b><a name="wm_classic_xpos">wm_classic_xpos(joystick)</a></b></tt><br>
  150. <tt><b><a name="wm_classic_ypos">wm_classic_ypos(joystick)</a></b></tt><br>
  151. <tt><b><a name="wm_classic_direction">wm_classic_direction(joystick)</a></b></tt><br>
  152. <tt><b><a name="wm_classic_pressure">wm_classic_pressure(joystick)</a></b></tt><br>
  153. <tt><b><a name="wm_guitar_xpos">wm_guitar_xpos()</a></b></tt><br>
  154. <tt><b><a name="wm_guitar_ypos">wm_guitar_ypos()</a></b></tt><br>
  155. <tt><b><a name="wm_guitar_direction">wm_guitar_direction()</a></b></tt><br>
  156. <tt><b><a name="wm_guitar_pressure">wm_guitar_pressure()</a></b></tt><br>
  157. <tt><b><a name="wm_drum_xpos">wm_drum_xpos()</a></b></tt><br>
  158. <tt><b><a name="wm_drum_ypos">wm_drum_ypos()</a></b></tt><br>
  159. <tt><b><a name="wm_drum_direction">wm_drum_direction()</a></b></tt><br>
  160. <tt><b><a name="wm_drum_pressure">wm_drum_pressure()</a></b></tt><br>
  161. </blockquote>
  162. <p>For the Classic Controller you must specify which joystick to check the values of, for this the following constants are defined:</p>
  163. <blockquote>
  164. <tt><b><a name="wm_joy_left">wm_joy_left</a></b></tt><br>
  165. <tt><b><a name="wm_joy_right">wm_joy_right</a></b></tt><br>
  166. </blockquote>
  167. <h2><a name="accel">Accelerometer Data</a></h2>
  168. <p>You can also get data from the Wii Remote and Nunchuck's accelerometers using the following functions:</p>
  169. <blockquote>
  170. <tt><b><a name="wm_get_accel_x">wm_get_accel_x()</a></b></tt><br>
  171. <tt><b><a name="wm_get_accel_y">wm_get_accel_y()</a></b></tt><br>
  172. <tt><b><a name="wm_get_accel_z">wm_get_accel_z()</a></b></tt><br>
  173. <tt><b><a name="wm_nunchuck_get_accel_x">wm_nunchuck_get_accel_x()</a></b></tt><br>
  174. <tt><b><a name="wm_nunchuck_get_accel_y">wm_nunchuck_get_accel_y()</a></b></tt><br>
  175. <tt><b><a name="wm_nunchuck_get_accel_z">wm_nunchuck_get_accel_z()</a></b></tt><br>
  176. </blockquote>
  177. <p>Please note that when you set the remote on a flat surface a value of approximately 1 will be returned on the Z axis. This is because the table is exerting an upwards force on your Wii Remote equal to 1G against the force of gravity. When the remote is in free fall this value will fall to near zero.<br>GiiMote also provides limited higher level functionality which utilizes the accelerometers:</p>
  178. <blockquote>
  179. <tt><b><a name="wm_get_moving">wm_get_moving()</a></b> Checks to see if the Wii Remote is moving or not</tt><br>
  180. </blockquote>
  181. <h2><a name="dead_zone">Dead Zone's</a></h2>
  182. <p>With any joystick, pressure sensitive trigger, or accelerometer differences in calibration can cause slight deviations from zero. For instance, a joystick centered at (0,0) may return (0.1,0) instead, or, an accelerometer sitting still may feel a slight tremor and read 0.01 when the user intended it to be 0. To address this issue one must define a &quot;dead zone,&quot; or, an amount of tolerance under which no change of value will occur. To set the tolerance level for all joysticks, triggers, and/or accelerometers the following functions may be called (default for all is no-tolerance):</p>
  183. <blockquote>
  184. <tt><b><a name="wm_set_accel_dead_zone_x">wm_set_accel_dead_zone_x(val)</a></b></tt> Domain from 0 to infinity.<br>
  185. <tt><b><a name="wm_set_accel_dead_zone_y">wm_set_accel_dead_zone_y(val)</a></b></tt><br>
  186. <tt><b><a name="wm_set_accel_dead_zone_x">wm_set_accel_dead_zone_z(val)</a></b></tt><br>
  187. <tt><b><a name="wm_get_accel_dead_zone_x">wm_get_accel_dead_zone_x()</a></b></tt><br>
  188. <tt><b><a name="wm_get_accel_dead_zone_y">wm_get_accel_dead_zone_y()</a></b></tt><br>
  189. <tt><b><a name="wm_get_accel_dead_zone_z">wm_get_accel_dead_zone_z()</a></b></tt><br>
  190. <tt><b><a name="wm_nunchuck_set_accel_dead_zone_x">wm_nunchuck_set_accel_dead_zone_x(val)</a></b></tt><br>
  191. <tt><b><a name="wm_nunchuck_set_accel_dead_zone_y">wm_nunchuck_set_accel_dead_zone_y(val)</a></b></tt><br>
  192. <tt><b><a name="wm_nunchuck_set_accel_dead_zone_z">wm_nunchuck_set_accel_dead_zone_z(val)</a></b></tt><br>
  193. <tt><b><a name="wm_nunchuck_get_accel_dead_zone_x">wm_nunchuck_get_accel_dead_zone_x()</a></b></tt><br>
  194. <tt><b><a name="wm_nunchuck_get_accel_dead_zone_y">wm_nunchuck_get_accel_dead_zone_z()</a></b></tt><br>
  195. <tt><b><a name="wm_nunchuck_get_accel_dead_zone_y">wm_nunchuck_get_accel_dead_zone_z()</a></b></tt><br>
  196. <tt><b><a name="wm_set_joystick_dead_zone">wm_set_joystick_dead_zone(val)</a></b></tt> Domain from 0 to 0.5.<br>
  197. <tt><b><a name="wm_get_joystick_dead_zone">wm_get_joystick_dead_zone()</a></b></tt><br>
  198. <tt><b><a name="wm_set_trigger_dead_zone">wm_set_trigger_dead_zone(val)</a></b></tt><br>
  199. <tt><b><a name="wm_get_trigger_dead_zone">wm_get_trigger_dead_zone()</a></b></tt> Domain from 0 to 1.<br>
  200. </blockquote>
  201. <p>Values outside of the feasible domain will be corrected to the nearest number in the domain.</p>
  202. <h2><a name="IR">Infrared Readout</a></h2>
  203. <p>To utilize pointer functionality in your games you will need to use the Wii Remotes final input method, infrared. To use infrared you will need to place the Wii's sensor bar above or below your screen and supply it with a 12 volt power supply. The sensor bar does not do any &quot;sensing&quot; itself, rather, it outputs infrared light from two sets of five infrared LED's spaced 7.5 inches apart on the bar. This light is picked up by an infrared camera on top of the Wii Remote which can then triangulate
  204. its orientation relative to the sensor bar. The following functions exist to use the Wii Remotes infrared capabilities, please note that values returned by these functions are relative to the Wii Remote, not to your screen.</p>
  205. <blockquote>
  206. <p><tt><b><a name="wm_ir_found_dot">wm_ir_found_dot(dot)</a></b></tt> Returns weather the Wii Remote can see the given dot (1, 2, 3, or 4) or not.<br>
  207. <tt><b><a name="wm_ir_dot_size">wm_ir_dot_size(dot)</a></b></tt> Returns the size of dot 1, 2, 3, or 4 as a value between 0 and 15.<br>
  208. <tt><b><a name="wm_ir_dot_get_x">wm_ir_dot_get_x(dot)</a></b></tt> Returns a normalized value between 0.0 and 1.0 for dot 1, 2, 3, or 4 along the x axis.<br>
  209. <tt><b><a name="wm_ir_dot_get_y">wm_ir_dot_get_y(dot)</a></b></tt> Returns a normalized value between 0.0 and 1.0 for dot 1, 2, 3, or 4 along the y axis.<br>
  210. <tt><b><a name="wm_ir_dot_get_midx">wm_ir_dot_get_midx()</a></b></tt> Returns the normalized x value of the midpoint between 0.0 and 1.0 for the first two IR points.<br>
  211. <tt><b><a name="wm_ir_dot_get_midy">wm_ir_dot_get_midy()</a></b></tt> Returns the normalized y value of the midpoint between 0.0 and 1.0 for the first two IR points.<br>
  212. <tt><b><a name="wm_ir_dot_get_delta_x">wm_ir_dot_get_delta_x(dot)</a></b></tt> Returns the change in the given dot's x value (&Delta;x) for the most recent update.<br>
  213. <tt><b><a name="wm_ir_dot_get_delta_y">wm_ir_dot_get_delta_y(dot)</a></b></tt> Returns the change in the given dot's y value (&Delta;y) for the most recent update.<br>
  214. <tt><b><a name="wm_ir_dot_get_delta_y">wm_ir_dot_get_delta_midx()</a></b></tt> Returns the change in the midpoint's x value for the most recent update.<br>
  215. <tt><b><a name="wm_ir_dot_get_delta_y">wm_ir_dot_get_delta_midy()</a></b></tt> Returns the change in the midpoint's y value for the most recent update.<br>
  216. </p>
  217. </blockquote>
  218. <p>The functions above get data directly from the Wii Remote and normalize it to fall in the specified domain. GiiMote provides several higher-level functions for getting points from the infrared data relative to the screen and window.</p>
  219. <blockquote>
  220. <p><tt><b><a name="wm_ir_display_get_x">wm_ir_display_get_x()</a></b></tt> Returns the x location on the display pointed at by the Wii Remote.<br>
  221. <tt><b><a name="wm_ir_display_get_y">wm_ir_display_get_y()</a></b></tt> Returns the y location on the display pointed at by the Wii Remote.<br>
  222. <tt><b><a name="wm_ir_window_get_x">wm_ir_window_get_x()</a></b></tt> Returns the x location in the window pointed at by the Wii Remote.<br>
  223. <tt><b><a name="wm_ir_window_get_y">wm_ir_window_get_y()</a></b></tt> Returns the y location in the window pointed at by the Wii Remote.<br>
  224. </p>
  225. </blockquote>
  226. <p>Finally, to change the sensitivity of the IR camera, the following functions may be called:</p>
  227. <blockquote>
  228. <p><tt><b><a name="wm_ir_set_sensitivity">wm_ir_set_sensitivity(sensitivity)</a></b></tt> Sets the sensitivity level of the IR camera (1-6, 3 is default)<br>
  229. <tt><b><a name="wm_ir_get_sensitivity">wm_ir_get_sensitivity()</a></b></tt> Returns the current sensitivity level of the Wii Remote.<br>
  230. </p>
  231. </blockquote>
  232. <h2><a name="MISC">Feedback</a></h2>
  233. <p>The Wii Remote can provide direct feedback to its users in several ways including four LED's on the front of the controller as well as force feedback by means of a weighted motor or by playing sounds through the embedded speaker. It is also possible to have the Wii Remote report the remaining battery life. Out of these options currently only sound is not supported.</p>
  234. <blockquote>
  235. <tt><b><a name="wm_get_led">wm_get_led(LED)</a></b></tt> Gets the status of LED 1, 2, 3 or 4 as a boolean value.<br>
  236. <tt><b><a name="wm_set_led">wm_set_led(LED,on)</a></b></tt> Sets the status of LED 1, 2, 3, or 4.<br>
  237. <tt><b><a name="wm_set_leds">wm_set_leds(led1,led2,led3,led4)</a></b></tt> Sets the status of LED's 1 - 4.<br>
  238. <tt><b><a name="wm_set_leds_int">wm_set_leds_int(leds)</a></b></tt> Sets the state of all LED's using an integer representation of the binary value which defines the LED's (1-15).<br>
  239. <tt><b><a name="wm_clear_leds">wm_clear_leds()</a></b></tt> Turns all four LED's off. (Same as calling wm_set_leds(0,0,0,0))<br>
  240. <tt><b><a name="wm_get_battery">wm_get_battery()</a></b></tt> Returns the remaining battery power of the Wii Remote as a byte between $00 (0) to roughly $C8 (200).<br>
  241. <tt><b><a name="wm_set_rumble">wm_set_rumble(rumble)</a></b></tt> Turns the Wii Remote's motor on or off.<br>
  242. <tt><b><a name="wm_get_rumble">wm_get_rumble()</a></b></tt> Checks to see if the Wii Remote's motor is currently active.<br>
  243. </blockquote>
  244. <p>The Wii Remote provides several different methods of feedback which can be utilized by the user. To save battery power, not all of these methods need to be turned on all the time. For instance, if we are not using the infrared capabilities of the Wii Remote it would save power to turn off the infrared camera. To do this we must change the report type of the Wii Remote. The following functions exist to deal with the various report types:</p>
  245. <blockquote>
  246. <tt><b><a name="wm_set_report_type">wm_set_report_type(report_type,continuous)</a></b></tt> Sets the report type of the Wii Remote. If continuous is false the Wii Remote only sends reports when it undergoes a status change.<br>
  247. <tt><b><a name="wm_get_report_type">wm_get_report_type()</a></b></tt> Returns the report type of the Wii Remote.<br>
  248. <tt><b><a name="wm_get_report_continuous">wm_get_report_continuous()</a></b></tt> Returns true if the Wii Remote is set to update continuously and false otherwise.<br>
  249. </blockquote>
  250. <p>The report type can be set using any of the following constants. Please note that the status of the Wii Remote's buttons is included in every report type and that only supported report types are listed here.</p>
  251. <blockquote>
  252. <tt><b><a name="rt_auto">rt_auto</a></b></tt> Automatically determine the report type. (Default)<br>
  253. <tt><b><a name="rt_buttons">rt_buttons</a></b></tt> Reports the status of the buttons on the Wii Remote only.<br>
  254. <tt><b><a name="rt_buttonsaccel">rt_buttonsaccel</a></b></tt> Reports the status of the buttons and accelerometers of the Wii Remote only.<br>
  255. <tt><b><a name="rt_buttonsextension">rt_buttonsextension</a></b></tt> Returns the status of the Wii Remote's buttons and current extension only.<br>
  256. <tt><b><a name="rt_extensionaccel">rt_extensionaccel</a></b></tt> Returns the status of the Wii Remote's buttons, current extension, and accelerometers.<br>
  257. <tt><b><a name="rt_iraccel">rt_iraccel</a></b></tt> Returns the status of the Wii Remote's buttons, infrared camera, and accelerometers.<br>
  258. <tt><b><a name="rt_irextensionaccel">rt_irextensionaccel</a></b></tt> Returns the status of the Wii Remote's buttons, infrared camera, current extension, and accelerometers.<br>
  259. <tt><b><a name="rt_readdata">rt_readdata</a></b></tt> Read data from the Wii Remote's memory space/registers only.<br>
  260. <tt><b><a name="rt_status">rt_status</a></b></tt> Returns the status of the Wii Remote only.<br>
  261. </blockquote>
  262. <h2><a name="orientation">Orientation</a></h2>
  263. <p>Several routines are defined to get the orientation of the Wii Remote. For most, the accelerometer data is all you will need, but for a few IR must be used as well.</p>
  264. <blockquote>
  265. <tt><b><a name="wm_get_roll">wm_get_roll()</a></b></tt> Returns the roll of the Wii Remote.<br>
  266. <tt><b><a name="wm_get_pitch">wm_get_pitch()</a></b></tt> Returns the pitch of the Wii Remote.<br>
  267. <tt><b><a name="wm_get_yaw">wm_get_yaw()</a></b></tt> Attempts to estimate the Yaw of the Wii Remote. Requires IR.<br>
  268. <tt><b><a name="wm_get_altitude">wm_get_altitude()</a></b></tt> Returns the distance from the sensor bar to the Wii Remote in meters. Requires IR.<br>
  269. </blockquote>
  270. <h2><a name="BB">Balance Board</a></h2>
  271. <p>The Balance Board accessory for the Wii contains four sensors at each corner of the board which each measure weight. The following functions can be used to obtain data (in either pounds or kilograms) from one or more of these sensors:</p>
  272. <blockquote>
  273. <tt><b><a name="wm_bb_get_weight_kgs">wm_bb_get_weight_kgs()</a></b></tt> The total mass on the Balance Board in kilograms.<br>
  274. <tt><b><a name="wm_bb_get_weight_lbs">wm_bb_get_weight_lbs()</a></b></tt> The total weight on the Balance Board in pounds.<br>
  275. <tt><b><a name="wm_bb_get_sensor_kgs">wm_bb_get_sensor_kgs(sensor)</a></b></tt> The mass on a particular sensor in kilograms.<br>
  276. <tt><b><a name="wm_bb_get_sensor_lbs">wm_bb_get_sensor_lbs(sensor)</a></b></tt> The mass on a particular sensor in pounds.<br>
  277. </blockquote>
  278. <p>To specify a sensor to read from one of the following constants may be used:</p>
  279. <blockquote>
  280. <tt><b><a name="bb_btmleft">bb_btmleft</a></b></tt><br>
  281. <tt><b><a name="bb_btmright">bb_btmright</a></b></tt><br>
  282. <tt><b><a name="bb_topleft">bb_topleft</a></b></tt><br>
  283. <tt><b><a name="bb_topright">bb_topright</a></b></tt><br>
  284. </blockquote>
  285. <p>Besides weight one can also calculate the center of gravity of the person on the balance board. To this end, the following functions can be used:</p>
  286. <blockquote>
  287. <tt><b><a name="wm_bb_get_center_of_gravity_x">wm_bb_get_center_of_gravity_x()</a></b></tt><br>
  288. <tt><b><a name="wm_bb_get_center_of_gravity_y">wm_bb_get_center_of_gravity_y()</a></b></tt><br>
  289. </blockquote>
  290. <h2><a name="MII">Mii Data</a></h2>
  291. <p>Mii's are avatars that a user can design on the Wii and use as a character in supported channels and games. Mii's can be stored on the Wii Remote to take between consoles. Mii's found in Mii Parade are also stored on the Wii Remote and occupy any space not taken up by user saved Mii data. Mii data comes in two 750 byte blocks each followed by a two byte CRC hash. The Wii console reads the first block of Mii data and then checks the CRC checksum, if they match the block
  292. is used, if not it goes onto the second block and if that does not check out no Mii's are displayed. The following functions allow you to dump and inject Mii data to and from the Wii Remote; if you wish to change the Mii's properties you will have to do so using Game Maker's built in file functions.</p>
  293. <blockquote>
  294. <tt><b><a name="wm_mii_data_dump">wm_mii_data_dump(path,block,mii)</a></b></tt> Dumps a single Mii from block 1 or 2 from the Wii Remote to the specified file. If no Mii is specified the entire block is dumped, if no block is specified both blocks are dumped.<br>
  295. <tt><b><a name="wm_mii_data_inject">wm_mii_data_inject(path,block,mii)</a></b></tt> Injects a Mii to the Wii Remote from the specified file. The file may contain either one or two blocks of data. If no Mii is specified the entire block is injected, if no block is specified then both blocks are injected. The CRC checksum is automatically updated for Mii's injected into the Wii Remote when this function is called, but not in the original file.<br>
  296. <tt><b><a name="wm_mii_update_crc">wm_mii_update_crc(path)</a></b></tt> Updates the CRC for a modified Mii data file dumped using wm_mii_data_dump. This does not update the CRC on the Wii Remote; to do this you must use wm_mii_data_inject!<br>
  297. <tt><b><a name="wm_mii_get_address">wm_mii_get_address(mii, block)</a></b></tt> Returns the address of a specific Mii (1-10) in a specific block (1 or 2).<br>
  298. </blockquote>
  299. <p>Please note that dumping and injecting Mii's is an <i>extremely</i> slow process. Use sparingly.</p>
  300. <h2><a name="fStream">Reading and Writing Data</a></h2>
  301. <p>There are two functions to read and write raw data from and to the Wii Remote. These functions allow you to define your own routines for changing unsupported settings. Please be warned: you can easily destroy the data on your Wii Remote using these functions. Use at your own risk! With that said, the functions are:</p>
  302. <blockquote>
  303. <tt><b><a name="wm_bin_write_byte">wm_bin_write_byte(address, byte)</a></b></tt><br>
  304. <tt><b><a name="wm_bin_write_byte">wm_bin_read_byte(address)</a></b></tt><br>
  305. </blockquote>
  306. <p>These functions require that you know something about how the Wii Remote stores data. More information can be found online.</p>
  307. <h2><a name="hidden">Raw Data Functions</a></h2>
  308. There are several functions to get raw, unprocessed data from the Wii Remote:
  309. <blockquote>
  310. <tt><b><a name="wm_get_accel_rawx">wm_get_accel_rawx()</a></b></tt><br>
  311. <tt><b><a name="wm_get_accel_rawy">wm_get_accel_rawy()</a></b></tt><br>
  312. <tt><b><a name="wm_get_accel_rawz">wm_get_accel_rawz()</a></b></tt><br>
  313. <tt><b><a name="wm_get_battery_raw">wm_get_battery_raw()</a></b></tt><br>
  314. <tt><b><a name="wm_nunchuck_get_accel_rawx">wm_nunchuck_get_accel_rawx()</a></b></tt><br>
  315. <tt><b><a name="wm_nunchuck_get_accel_rawy">wm_nunchuck_get_accel_rawy()</a></b></tt><br>
  316. <tt><b><a name="wm_nunchuck_get_accel_rawz">wm_nunchuck_get_accel_rawz()</a></b></tt><br>
  317. <tt><b><a name="wm_ir_dot_get_rawx">wm_ir_dot_get_rawx(dot)</a></b></tt><br>
  318. <tt><b><a name="wm_ir_dot_get_rawy">wm_ir_dot_get_rawy(dot)</a></b></tt><br>
  319. <tt><b><a name="wm_ir_dot_get_rawmidx">wm_ir_dot_get_rawmidx()</a></b></tt><br>
  320. <tt><b><a name="wm_ir_dot_get_rawmidy">wm_ir_dot_get_rawmidy()</a></b></tt><br>
  321. <tt><b><a name="wm_ir_dot_get_delta_rawx">wm_ir_dot_get_delta_rawx(dot)</a></b></tt><br>
  322. <tt><b><a name="wm_ir_dot_get_delta_rawy">wm_ir_dot_get_delta_rawy(dot)</a></b></tt><br>
  323. <tt><b><a name="wm_ir_dot_get_delta_rawmidx">wm_ir_dot_get_delta_rawmidx()</a></b></tt><br>
  324. <tt><b><a name="wm_ir_dot_get_delta_rawmidy">wm_ir_dot_get_delta_rawmidy()</a></b></tt><br>
  325. <tt><b><a name="wm_classic_trigger_raw">wm_classic_trigger_raw(trigger)</a></b></tt><br>
  326. <tt><b><a name="wm_nunchuck_rawx">wm_nunchuck_rawx()</a></b></tt><br>
  327. <tt><b><a name="wm_nunchuck_rawy">wm_nunchuck_rawy()</a></b></tt><br>
  328. <tt><b><a name="wm_classic_rawx">wm_classic_rawx(joystick)</a></b></tt><br>
  329. <tt><b><a name="wm_classic_rawy">wm_classic_rawy(joystick)</a></b></tt><br>
  330. <tt><b><a name="wm_guitar_rawx">wm_guitar_rawx()</a></b></tt><br>
  331. <tt><b><a name="wm_guitar_rawy">wm_guitar_rawy()</a></b></tt><br>
  332. <tt><b><a name="wm_guitar_whammybar_rawpos">wm_guitar_whammybar_rawpos()</a></b></tt><br>
  333. <tt><b><a name="wm_bb_get_sensor_raw">wm_bb_get_sensor_raw(sensor)</a></b></tt><br>
  334. <tt><b><a name="wm_drum_rawx">wm_drum_rawx()</a></b></tt><br>
  335. <tt><b><a name="wm_drum_rawy">wm_drum_rawy()</a></b></tt><br>
  336. </blockquote>
  337. <p>These functions are for advanced use only and return data that has not been normalized.</p>
  338. <h2><a name="calibration">Calibration</a></h2>
  339. It is also possible to set the calibration data for the Wii Remote and extensions. The following functions exist to deal with calibration data:
  340. <blockquote>
  341. <p><tt><b><a name="wm_get_calibration_x0">wm_get_calibration_x0,y0, and z0()</a></b></tt> Returns the zero points for the x, y and z axes<br>
  342. <tt><b><a name="wm_get_calibration_xg">wm_get_calibration_xg,yg, and zg()</a></b></tt> Returns the +1G points for the x, y and z axes<br>
  343. <tt><b><a name="wm_set_calibration_x0">wm_set_calibration_x0,y0, and z0(val)</a></b></tt> Sets the zero points for the x, y and z axes<br>
  344. <tt><b><a name="wm_set_calibration_xg">wm_set_calibration_xg,yg, and zg(val)</a></b></tt> Sets the +1G points for the x, y and z axes<br>
  345. <tt><b><a name="wm_nunchuck_get_calibration_x0">wm_nunchuck_get_calibration_x0,y0, and z0()</a></b></tt> Returns the zero points for the x, y and z axes<br>
  346. <tt><b><a name="wm_nunchuck_get_calibration_xg">wm_nunchuck_get_calibration_xg,yg, and zg()</a></b></tt> Returns the +1G points for the x, y and z axes<br>
  347. <tt><b><a name="wm_nunchuck_get_calibration_maxx">wm_nunchuck_get_calibration_maxx and maxy()</a></b></tt> Returns the joystick X/Y-axis' maximum value<br>
  348. <tt><b><a name="wm_nunchuck_get_calibration_midx">wm_nunchuck_get_calibration_midx and midy()</a></b></tt> Returns the joystick X/Y-axis' center value<br>
  349. <tt><b><a name="wm_nunchuck_get_calibration_minx">wm_nunchuck_get_calibration_miny and miny()</a></b></tt> Returns the joystick X/Y-axis' minimum value<br>
  350. <tt><b><a name="wm_nunchuck_set_calibration_xg">wm_nunchuck_set_calibration_xg,yg, and zg(val)</a></b></tt> Sets the +1G points for the x, y and z axes<br>
  351. <tt><b><a name="wm_nunchuck_set_calibration_x0">wm_nunchuck_set_calibration_x0,y0, and z0(val)</a></b></tt> Sets the zero points for the x, y and z axes<br>
  352. <tt><b><a name="wm_nunchuck_set_calibration_maxx">wm_nunchuck_set_calibration_maxx and maxy(val)</a></b></tt> Sets the joystick X/Y-axis' maximum value<br>
  353. <tt><b><a name="wm_nunchuck_set_calibration_midx">wm_nunchuck_set_calibration_midx and midy(val)</a></b></tt> Sets the joystick X/Y-axis' center value<br>
  354. <tt><b><a name="wm_nunchuck_set_calibration_minx">wm_nunchuck_set_calibration_minx and miny(val)</a></b></tt> Sets the joystick X/Y-axis' minimum value<br>
  355. <tt><b><a name="wm_classic_get_calibration_trigger">wm_classic_get_calibration_maxtrigger and mintrigger(trigger)</a></b></tt> Returns the maximum and minimum trigger values<br>
  356. <tt><b><a name="wm_classic_get_calibration_maxx">wm_classic_get_calibration_maxx and maxy(joystick)</a></b></tt> Returns maximum joystick values for the x or y axis<br>
  357. <tt><b><a name="wm_classic_get_calibration_midx">wm_classic_get_calibration_midx and midy(joystick)</a></b></tt> Returns the centered joystick values for the x or y axis<br>
  358. <tt><b><a name="wm_classic_get_calibration_minx">wm_classic_get_calibration_minx and miny(joystick)</a></b></tt> Returns the minimum joystick values for the x or y axis<br>
  359. <tt><b><a name="wm_classic_set_calibration_trigger">wm_classic_set_calibration_maxtrigger and mintrigger(trigger, val)</a></b></tt> Sets the maximum and minimum trigger values<br>
  360. <tt><b><a name="wm_classic_set_calibration_maxx">wm_classic_set_calibration_maxx and maxy(joystick, val)</a></b></tt> Sets the maximum joystick values for the x or y axis<br>
  361. <tt><b><a name="wm_classic_set_calibration_midx">wm_classic_set_calibration_midx and midy(joystick, val)</a></b></tt> Sets the centered joystick values for the x or y axis<br>
  362. <tt><b><a name="wm_classic_set_calibration_minx">wm_classic_set_calibration_minx and miny(joystick, val)</a></b></tt> Sets the minimum joystick values for the x or y axis<br>
  363. <tt><b><a name="wm_bb_get_calibration_kg0">wm_bb_get_calibration_kg0, kg17, and kg34(sensor)</a></b></tt> Gets the calibration value for 0kg, 17kg, or 34kg for the given sensor<br>
  364. <tt><b><a name="wm_bb_set_calibration_kg0">wm_bb_set_calibration_kg0, kg17, and kg34(sensor, val)</a></b></tt> Sets the calibration value for 0kg, 17kg, or 34kg for the given sensor<br>
  365. </p>
  366. </blockquote>
  367. <p>NOTE: These functions are for advanced use only and can cause your Wii Remote to function poorly if used improperly.</p>
  368. <p><!--END-->
  369. </p>
  370. </body>
  371. </html>