Wii API’s

December 24, 2007

I have been standing in line for a while now to get a chance to try out the Wii at Makro. Unfortunately so are quite a few children. I may just have to buy one untried now that I have seen the Wii Opera SDK. This includes:

Wii Remote detectionRemote Demo, VR Head Tracking Demo

Receive status Wii Remote buttons, pointer coordinates, sensor bar distance, and Z-axis roll.
3D rotationsCube Demo, Rippling Water Demo
Rotate polygons in 3D space then translate them to z-sorted 2D to add that extra dimension to graphics.
Drawing effectsShip Demo, Wall Demo, Floor Demo

Draw lines, circles, rectangles, tiles, texture-mapped walls, and more.
Multiuser Communication
Allow multiple players/users to take part in the same of software.

Download the SDK: Wii Remote, Graphics, 3D Math (General | FPS)

View the documentation.

also check out the wii remote api which the Opera folk have released. Allowing you to be able to monitor all of the remotes that are connected with The Wii Remote API.

  1.  
  2. //Obtaining the roll of the third Wii remote in degrees
  3.  
  4. var remote, roll = 0;
  5. //check if the browser provides access to the Wii Remote data
  6. if( window.opera && opera.wiiremote ) {
  7.   //get the KpadStatus object for the third Wii Remote
  8.   remote = opera.wiiremote.update(2);
  9.   //check that the remote is enabled
  10.   if( remote.isEnabled ) {
  11.     //get the roll angle in radians
  12.     roll = Math.atan2( remote.dpdRollY, remote.dpdRollX );
  13.     //convert the roll to degrees
  14.     roll = roll * ( 180 / Math.PI );
  15.   }
  16. }
  17.  
  18. // Checking what buttons are pressed on the second remote
  19. var remote, buttons = {};
  20. //check if the browser provides access to the Wii Remote data
  21. if( window.opera && opera.wiiremote ) {
  22.   //get the KpadStatus object for the third Wii Remote
  23.   remote = opera.wiiremote.update(1);
  24.   //check that the remote is enabled
  25.   if( remote.isEnabled ) {
  26.     //use the bitwise AND operator to compare against the bitmasks
  27.     buttons.pressedLeft = remote.hold & 1;
  28.     buttons.pressedRight = remote.hold & 2;
  29.     buttons.pressedDown = remote.hold & 4;
  30.     buttons.pressedUp = remote.hold & 8;
  31.     buttons.pressedPlus = remote.hold & 16;
  32.     buttons.pressed2 = remote.hold & 256;
  33.     buttons.pressed1 = remote.hold & 512;
  34.     buttons.pressedB = remote.hold & 1024;
  35.     buttons.pressedA = remote.hold & 2048;
  36.     buttons.pressedMinus = remote.hold & 4096;
  37.     buttons.pressedZ = remote.hold & 8192;
  38.     buttons.pressedC = remote.hold & 16384;
  39.   }
  40. }
  41.  

Tasty!!!

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: