Welcome! Log In Create A New Profile

Advanced

Classic Controller and Nunchuk interference

Posted by Arikado 
Classic Controller and Nunchuk interference
October 18, 2008 09:03PM
Well working on the next version of wii shooting gallery I realized the following problem: some of the buttons on the nunchuck have the exact same constant values as some of the buttons on the classic controller. For example:

if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C)
shoot();

if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_LEFT)
moveleft();
If the following is run, the sprite will fire and move left when either C or LEFT is pressed. Also, the nunchuk's analog stick interferes with the classic's left analog stick (which is actually convienent for me) and Z interferes with the classic's UP.

To fix this problem, my code would have to look like this:
//if nunchuk is connected
if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_NUNCHUK_BUTTON_C)
shoot();

//if classic is connected
if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_CLASSIC_BUTTON_LEFT)
moveleft();

Unfortunately, I don't know what code would be used to fill in the commented code.

I appreciate any and all help. Thanks - Arikado
Re: Classic Controller and Nunchuk interference
October 19, 2008 06:00AM
To quote from my own game...

WPADData* data = WPAD_Data(WPAD_CHAN_0);
	switch (data->exp.type) {
		case WPAD_EXP_NONE:
			// Default Wiimote controls
			break;
		case WPAD_EXP_NUNCHUK:
			break;
		case WPAD_EXP_CLASSIC:
			// TODO: I don't have a classic controller...
			break;
		case WPAD_EXP_GUITARHERO3:
			// asdf
			break;
	}
Re: Classic Controller and Nunchuk interference
October 19, 2008 02:23PM
Thankyou, thankyou, thankyou! I spent anout an hour going through libogc before I posted. Thankyou :)

EDIT: I fixed my interference problems.



Edited 1 time(s). Last edit at 10/20/2008 05:55PM by Arikado.
Sorry, only registered users may post in this forum.

Click here to login