The usual samples show a code fragment like this:
Controller[] controllers = driver.getKnownControllers();
while(true) {
for (Controller ctl : controllers) {
ctl.poll();
EventQueue queue = ctl.getEventQueue();
// do stuff
}
}
Which works great in my testing.
But by placing the getKnownControllers() outside of the infinite loop, you will not detect any changes. The user could plug in a new controller, or even swap one for another, and the sample code will not detect it.
Is this a reasonable restriction? Is it acceptable to use this design? or should the main loop also check occasionally for new controllers?