Good news is I was able to work a little on this. Thanks mjoyner for the tip. I haven't used libGDX or Flixel before a few days ago, but I'm liking what I'm seeing from both.
I started using Flixel with the setupui for flixel which included an Oct 2012 release of libGDX. The latest version of libGDX does have Ouya Controller support. Not sure how well it works, but I wrote the following, mimicking Flixel's keyboard input class:
However I'm not sure if it works, because I've not been able test it on Ouya. I get the following error when attempting to install on the emulator as well:
java.lang.UnsatisfiedLinkError: couldn't load gdx: findLibrary returned null
I'm unsure I'll be able to have time to correct this before I have to give the Ouya back that I'm borrowing. If not soon, I'll have to wait until mine comes in march.
Use the latest libGDX project setup and compare to what you have in your existing projects. Sounds like you are missing the armabi bins or something similar.
Hey guys, I appreciate the feedback, this solution is quite elegant.
I did some testing and i got good results when the buttons were kept pressed, however "justPressed (key)" and "justReleased (key)" behave strangely. "justPressed (key)" keeps returning "true" after a few frames while the button is pressed.
"justReleased (key)" returns "true" forever.
I first thought it was because there was a controller for each player, however, the problem persists even if there is only one controller/player .Besides, There is no conflict between the inputs from one player to another as long as each one has its own controller instantiated.
Do not know yet what's going on.
I'll let you know if I find something.
Thanks.
[EDIT]
I guess I am doing something wrong with the Controllers objects... When I try with only 1 controller and regular FlxG.keys.justPressed ("LEFT") or FlxG.keys.justReleased("RIGHT") it works. Unfortunately I do not see how could more than one controller work together using FlxG.keys stuff, I'll do some more tests.
Thanks for the updates. I had to give back the dev ouya I was borrowing, so I won't be able to continue developing on the system itself until I get mine in March. I will continue to work on my Flixel project and keep an eye on here for solutions to the controller problems.
I was hoping to make my game single screen multiplayer, so a solution to using multiple controllers would be nice. Thanks again!
I did some testing and i got good results when the buttons were kept pressed, however "justPressed (key)" and "justReleased (key)" behave strangely. "justPressed (key)" keeps returning "true" after a few frames while the button is pressed.
"justReleased (key)" returns "true" forever.
Call the OuyaController.update() somewhere inside the loop and it works :)
Comments
"justPressed (key)" keeps returning "true" after a few frames while the button is pressed.
Thanks.
[EDIT]
I guess I am doing something wrong with the Controllers objects...
When I try with only 1 controller and regular FlxG.keys.justPressed ("LEFT") or FlxG.keys.justReleased("RIGHT") it works. Unfortunately I do not see how could more than one controller work together using FlxG.keys stuff, I'll do some more tests.
useful information:
http://forums.ouya.tv/discussion/404/controller-buttons-only-readable-through-onkeydown-and-onkeyup#latest
I was hoping to make my game single screen multiplayer, so a solution to using multiple controllers would be nice. Thanks again!