// try to connect any additional wiimotes (just to show the code)
_tprintf(_T("\n\n")); // [1]
wiimote *extra_motes [7] = { NULL }; // 7 should cover it [2]
unsigned detected = 0;
while(detected < 7)
{
wiimote *next = new wiimote; // [3]
if(!next->Connect(wiimote::FIRST_AVAILABLE)) // [4]
break;
extra_motes[detected++] = next; // [5]
WHITE ; _tprintf(_T(" also found wiimote ")); // [6]
BRIGHT_GREEN; _tprintf(_T("%u"), detected+1); // [7]
if(next->IsBalanceBoard()) { // [8]
WHITE; _tprintf(_T(" (Balance Board)"));
}
_tprintf(_T("\n\n"));
# ifdef USE_BEEPS_AND_DELAYS
Beep(1000 + (detected*100), 100); // [9]
Sleep(500);
# endif
}
WHITE; _tprintf( ((detected == 7)? _T(" (can't detect any more).") :
_T(" (no more found).")) );
# ifdef USE_BEEPS_AND_DELAYS
Sleep(2000);
# endif
// clean up
for(unsigned index=0; index<detected; index++)
delete extra_motes[index];
SetConsoleCursorPosition(console, cursor_pos);
#endif // LOOK_FOR_ADDITIONAL_WIIMOTES

