public OisControllers (final DesktopControllerManager manager) {
this.manager = manager;
ArrayList<OisJoystick> joysticks = ois.getJoysticks();
controllers = new OisController[joysticks.size()];
for (int i = 0, n = joysticks.size(); i < n; i++) {
OisJoystick joystick = joysticks.get(i);
controllers[i] = new OisController(joystick);
manager.controllers.add(controllers[i]);
}
new Runnable() {
public void run () {
long newWindowHandle = getWindowHandle();
if(hwnd != newWindowHandle){
hwnd = newWindowHandle;
ois = new Ois(newWindowHandle);
ArrayList<OisJoystick> joysticks = ois.getJoysticks();
controllers = new OisController[joysticks.size()];
manager.controllers.clear();
for (int i = 0, n = joysticks.size(); i < n; i++) {
OisJoystick joystick = joysticks.get(i);
controllers[i] = new OisController(joystick);
manager.controllers.add(controllers[i]);
}
}
ois.update();