Guitar Hero Controller strum Help March 07, 2009 08:10AM | Registered: 14 years ago Posts: 444 |
WPAD_ScanPads(); u32 buttonsDown = WPAD_ButtonsDown(0); u32 buttonsHeld = WPAD_ButtonsHeld(0); if( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_GREEN ) { printf("Green pressed.\n"); } if( buttonsDown & (WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN || WPAD_GUITAR_HERO_3_BUTTON_STRUM_UP ) ) { printf("You Have Strummed"); }Thanks
Re: Guitar Hero Controller strum Help March 08, 2009 04:14AM | Registered: 14 years ago Posts: 13 |
(WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN || WPAD_GUITAR_HERO_3_BUTTON_STRUM_UP )Obviously this would result in unwanted results in your second if statement, since you end up doing a binary and operation with buttonsDown and 1, instead of buttonsDown and WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN and WPAD_GUITAR_HERO_3_BUTTON_STRUM_UP respectively.
if ( ( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN ) || ( buttonsDown & WPAD_GUITAR_HERO_BUTTON_STRUM_UP ) ) { printf( "You have strummed." ); }
Re: Guitar Hero Controller strum Help March 08, 2009 04:52AM | Registered: 14 years ago Posts: 152 |
Re: Guitar Hero Controller strum Help March 08, 2009 05:30AM | Registered: 14 years ago Posts: 444 |
Thanks, but now i have one other problem, when i strum up the screen also say's that i have pushed 2.Quote
Botskiz
Correct me if I'm wrong, but wouldn't this expression always be 1, since both values are non zero and you're comparing them with a logical or?(WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN || WPAD_GUITAR_HERO_3_BUTTON_STRUM_UP )Obviously this would result in unwanted results in your second if statement, since you end up doing a binary and operation with buttonsDown and 1, instead of buttonsDown and WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN and WPAD_GUITAR_HERO_3_BUTTON_STRUM_UP respectively.
I suggest trying it that way, and see if if it works.if ( ( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN ) || ( buttonsDown & WPAD_GUITAR_HERO_BUTTON_STRUM_UP ) ) { printf( "You have strummed." ); }
if( buttonsDown & WPAD_BUTTON_2 ) { printf("Button 2 pressed.\n"); }Do they happen to share the same bit's? this doesn't happen when i just hit the 2 button though
if( buttonsDown & WPAD_NUNCHUK_BUTTON_Z ) { printf("Button Z pressed.\n"); }
Re: Guitar Hero Controller strum Help March 08, 2009 02:57PM | Admin Registered: 14 years ago Posts: 5,132 |
Re: Guitar Hero Controller strum Help March 08, 2009 04:24PM | Registered: 14 years ago Posts: 13 |
u32 expType = 0; // Stores only the controller/expansion type. // Use WPAD_Probe to get the expansion type. WPAD_Probe( WPAD_CHAN_0, &expType ); if ( ( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN ) && ( expType == WPAD_EXP_GUITARHERO3 ) ) { printf( "You have strummed down." ); }
expansion_t *ext; // Pointer to the expansion data. // Use WPAD_Expansion() to the the expansion data. WPAD_Expansion( WPAD_CHAN_0, ext ); if ( ( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN ) && ( exp->type == WPAD_EXP_GUITARHERO3 ) ) { printf( "You have strummed down." ); }
WPADData *padData; // Pointer to the wii remote data. // Use WPAD_Data() to get any Wii remote data. padData = WPAD_Data( WPAD_CHAN_0 ); if ( ( buttonsDown & WPAD_GUITAR_HERO_3_BUTTON_STRUM_DOWN ) && ( padData->exp.type == WPAD_EXP_GUITARHERO3 ) ) { printf( "You have strummed down." ); }
Re: Guitar Hero Controller strum Help July 01, 2009 05:59AM | Registered: 13 years ago Posts: 234 |
Re: Guitar Hero Controller strum Help July 01, 2009 10:03AM | Registered: 13 years ago Posts: 5,075 |
Re: Guitar Hero Controller strum Help July 01, 2009 12:43PM | Registered: 14 years ago Posts: 265 |
Re: Guitar Hero Controller strum Help July 08, 2009 01:12AM | Registered: 13 years ago Posts: 379 |
Re: Guitar Hero Controller strum Help July 08, 2009 02:10PM | Registered: 14 years ago Posts: 265 |
Re: Guitar Hero Controller strum Help July 19, 2009 07:41PM | Registered: 13 years ago Posts: 379 |