Wiimote Rumble Question [Solved] March 09, 2009 06:42AM | Registered: 14 years ago Posts: 83 |
if pointer is highlighting an option = rumble, but doesn't stop if pointer is highlighting an option + press A = rumble stop if pointer not highlighting any option = no rumbleMy question is, how do I get it to only rumble for 1 second, then stop, when an option is highlighted? I've looked over several threads about this here, and I didn't really find anything that helped.
Re: Wiimote Rumble Question March 09, 2009 07:20AM | Registered: 15 years ago Posts: 13 |
Re: Wiimote Rumble Question March 09, 2009 11:40AM | Admin Registered: 15 years ago Posts: 5,132 |
int rumbletime = 0;
if(conditions_are_met){ rumbletime = 1; WPAD_Rumble(WPAD_CHAN_0, 1); }
if(rumbletime == 7){ rumbletime = 0; WPAD_Rumble(WPAD_CHAN_0, 0); } if(rumbletime >= 1) rumbletime++;
Re: Wiimote Rumble Question March 09, 2009 11:49PM | Registered: 14 years ago Posts: 83 |
int rumbletime = 0Rumble function in pointer.c:
if (selection != last_selection && selection != 0) { rumble_time = 1; WPAD_Rumble(WPAD_CHAN_0, 1); }Not exactly sure where to put this, but tried putting it in menu_loop(), in my menu.c file:
if(rumbletime == 7){ rumbletime = 0; WPAD_Rumble(WPAD_CHAN_0, 0); } if(rumbletime >= 1) rumbletime++;When I try to compile, I get the following errors:
In file included from c:/projects/wii/source/pointer.c:3: c:/projects/wii/source/pointer.c: In function 'void dorumble(int)': c:/projects/wii/source/pointer.c:45: error: 'rumbletime' was not declared in this scope make[1]: *** [pointer.o] Error 1 "make": *** [build] Error 2
if (selection != last_selection && selection != 0) { rumble_time = 1; WPAD_Rumble(WPAD_CHAN_0, 1); }Which caused it to ALWAYS rumble. I got it to rumble for only 1 second by changing it to this:
if (selection != last_selection && selection != 0) { if (rumble_count <= rumble_time) { WPAD_Rumble(WPAD_CHAN_0, 1); rumble_count++; } }Yay, go me. Thanks for all the help guys!
Re: Wiimote Rumble Question March 10, 2009 04:55PM | Admin Registered: 15 years ago Posts: 5,132 |
Re: Wiimote Rumble Question March 10, 2009 05:48PM | Registered: 14 years ago Posts: 83 |
Quote
Arikado
The one glaring error I see in your code is that you use the variables rumbletime and rumble_time. Thats two variables, you should only be using one.
Quote
Arikado
If you're getting a black screen, thats from something else in your program and not my rumble code. So I dont think I can help you with that, sorry.