Welcome! Log In Create A New Profile

Advanced

Wii Balansboard example

Posted by wplaat 
Wii Balansboard example
January 03, 2009 10:51PM
Hello everybody,

Does some has a working example how to readout the Wii Balansboard. I would like to integrated this device in my game.
Looking forward to your reactions. Happy new year to everybody.

wplaat



Edited 1 time(s). Last edit at 01/03/2009 10:59PM by wplaat.
Re: Wii Balansboard example
January 03, 2009 11:38PM
Hi.

Please see my svn repository (access via svn or http) at [svn.kapsi.fi]
for example code.

You also need the svn version of libogc from the devkitpro sourceforge repository at
[devkitpro.svn.sourceforge.net]

Happy hacking.
Re: Wii Balansboard example
January 04, 2009 04:16AM
Im working on a tutorial for it to be put on wiibrew soon.
Re: Wii Balansboard example
January 04, 2009 12:48PM
Hi Hattivatti,

Thanks for your reply. I will study your example. If it is working fine i will add your source code in the RedSquare game and add your nickname in the credit page as reward ;-}

wplaat



Edited 2 time(s). Last edit at 01/04/2009 12:50PM by wplaat.
Re: Wii Balansboard example
January 07, 2009 09:30PM
Hi Hattivatti,

Were is the WPAD_BALANCE_BOARD value defined. I can not find it?

wplaat
Re: Wii Balansboard example
January 07, 2009 09:31PM
wpad.h
Re: Wii Balansboard example
January 07, 2009 10:39PM
The value is defined as four. When programming with it, use an expansion struct.

expansion_t balanceboard;
balanceboard.type = WPAD_EXP_WIIBOARD;
//Check for data from it every loop using:
WPAD_Expansion(WPAD_BALANCE_BOARD, &balanceboard);

Also, be sure to move your red square sprite according to the balance boards X and Y values (which is what I did in WiiBreaker). Good luck :)

From my WiiBreaker source code:

                      WPAD_Expansion(WPAD_BALANCE_BOARD, &exp2);//Get data from the attached expansion (the balance board in this case)
		
		x = exp2.wb.x;
		
		//Left Movements
		
		if(x < -4)
		paddlex -= 4;
		
		if(x < -8)
		paddlex -= 5;
		
		if(x < -13)
		paddlex -= 6;
		
		if(x < -15)
		paddlex -= 7;
		
		if(x < -18)
		paddlex -= 8;
		
		//Right Movements
		
		if(x > 4)
		paddlex += 4;
		
		if(x > 8)
		paddlex += 5;
		
		if(x > 13)
		paddlex += 6;
		
		if(x > 15)
		paddlex += 7;
		
		if(x > 18)
		paddlex += 8;



Edited 4 time(s). Last edit at 01/07/2009 10:42PM by Arikado.
Sorry, only registered users may post in this forum.

Click here to login