It looks like you're new here. If you want to get involved, click one of these buttons!
OuyaController c = OuyaController.getControllerByPlayer(playerNum);Then you call:
OuyaController controller = OuyaController.getControllerByDeviceId(deviceId);
And here you are you got every Event for the right Controller and Player.
Answers
public boolean onKeyDown(int keyCode, KeyEvent event) {
int deviceID = event.getDeviceId();
OuyaController controller = OuyaController.getControllerByDeviceId(deviceID);
System.out.println("Controller number " + controller.getPlayerNum());
...
}
The deviceID is coming thought fine (it's like 5 at the moment). Could the null controller be caused by what you described in the PPS, or is it a different problem?
In response to your PS, I was planning on making a "smart ouya activitiy" class that would handle all of these button stuff; also a solid approach.
Thanks for your help.
public boolean onKeyDown(int keyCode, KeyEvent event) {
boolean handled = OuyaController.onKeyDown(keyCode, event);
int deviceID = event.getDeviceId();
OuyaController controller = OuyaController.getControllerByDeviceId(deviceID);
System.out.println("Controller number " + controller.getPlayerNum());
...
}
I think the OUYA Controller Class recognizes Controller with this codeLine: OuyaController.onKeyDown(keyCode,Event) .
But i am not sure. In my code this codeline is always executed first and the controller isnt null.