Nunchuck

support for the powerpc toolchain
Post Reply
Ghost6765

Nunchuck

Post by Ghost6765 » Tue Sep 07, 2010 3:59 pm

Recently I put a post that got disapproved by Izhido and I did what he said (To Try & Find Out Myself In The Examples Folder) but I still can't find out how to use the Nunchuck in my games? Does someone else know?






I put ? marks like you said Wintermute

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: Nunchuck

Post by Izhido » Tue Sep 07, 2010 5:53 pm

Amazing. I was completely sure there was code in there showing input devices. Guess I was wrong, after all :D .

Anyway, try this:

Code: Select all

	expansion_t e;
	int nx;
	int ny;

	WPAD_Expansion(WPAD_CHAN_0, &e);
	if(e.type != WPAD_EXP_NUNCHUK)
	{
		iprintf("Nunchuk not attached to Wiimote 0");
	}
	nx = e.nunchuk.js.pos.x - e.nunchuk.js.center.x;
	ny = e.nunchuk.js.pos.y - e.nunchuk.js.center.y;

nx and ny should contain valid values for the nunchuk's joystick. Check the "expansion_t" structure in libogc's header files. All the keys & controls for the expansion devices (like the nunchuk) should be right there.

Of course, be sure to call WPAD_Init() before attempting to use this code in your application.

Hope that helps.

Ghost6765

Re: Nunchuck

Post by Ghost6765 » Fri Sep 10, 2010 9:42 pm

These are all the questions I have: How to do movement?

User avatar
Izhido
Posts: 107
Joined: Fri Oct 19, 2007 10:57 pm
Location: Costa Rica
Contact:

Re: Nunchuck

Post by Izhido » Sat Sep 11, 2010 12:07 am

How do you define "movement" ? What actions are you performing with the nunchuk that cause what you're calling "movement", and what do you expect from your app when you do that?

Ghost6765

Re: Nunchuck

Post by Ghost6765 » Sat Sep 11, 2010 10:30 am

I mean if you push the control stick (UP, DOWN, LEFT or RIGHT) The sprite on screen will do so. I think it is the values that you said but I don't know how to use them.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest