How I can use O,Y,U,A buttons on AVD Emulator? I setted AVD Emulator followed this tutorial https://devs.ouya.tv/developers/docs/setup but I can't do any think in samples delivery with ODK..
As it is already mentioned in the setup tutorial, it should not be possible to fully emulate the ouya controller buttons and features :(
However, it is not that difficult to, at least, implement some basic functionality. For example, have a look at the ControllerTestActivity which is one of the delivered examples. In the activity class, input is handled via the onKeyDown(...) and onKeyUp(...) methods, which call call the onKeyUp(...) and onKeyDown(...) methods in the ControllerView class.
To get this example run on my AVD, I just had to convert the keyCodes from my keyboard button values to the OUYA button values. I wrote a static method for this purpose:
public static int keyboardOuyaConverter(int keyCode) {
switch (keyCode) {
// Keyboard Button - Ouya Button
// =============================
// O - BUTTON_O
case 43:
return 96;
// A - BUTTON_A
case 29:
return 97;
// U - BUTTON_U
case 49:
return 99;
// Y - BUTTON_Y
case 53:
return 100;
// Q - BUTTON_L1
case 45:
return 102;
// E - BUTTON_R1
case 33:
return 103;
// W - BUTTON_L2
case 51:
return 104;
// R - BUTTON_R2
case 46:
return 105;
// J - AXIS_RS_X
case 38:
return 11;
// K - AXIS_RS_Y
case 39:
return 14;
default:
return keyCode;
}
}
And then just modified the onKeyUp/Down methods a bit, like:
It's a pretty simple solution, but it worked for me. Unfortunately the AVD emulators do not seem to support controller, as far as I know.
I decided to write a simple application, that would convert my controller input into keyboard input and therefore managed to even get a controller running on my AVD within OUYA apps. Hope I could help :)
but how do you use the ControllerTestActivity if you cannot setup OUYA, i mean if one cannot pass the first init screen asking for a dpad device to be detected
it is a shame that google did not add usb support to the emulator to plug a real hardware gamepad or dpad
Answers