OUYA - Menu Button

Monkey Forums/Monkey Bug Reports/OUYA - Menu Button

ElectricBoogaloo(Posted 2013) [#1]
First up, apologies if this has already been fixed in future editions, or if it's something to do with my lack of Android SDK installs, or some other such nonsense. (So many possibilities!)

I've spent the past half hour checking, rechecking and triple-checking my button code, and flags, and everything, and finally found the problem.

If I keep JoyDown(JOY_MENU) rendered on the screen, it's blindingly obvious.

JoyDown(JOY_MENU) isn't acting like a Button. Instead, it's acting like a Toggle.
The first time you hit the Menu button, it becomes "Active" and JoyDown(JOY_MENU) shows 1.
If you release, it STAYS as 1.
The second time you hit it, it switches it back off again.

This basically means that if you're expecting JoyDown() to work.. It ain't gonna!
And as a result, JoyHit() is even quirkier, triggering every other tap, instead of every tap.

Like I said, whether this is my Devkit (Plain Android SDK 16, no OUYA specific extras installed) or Monkey (75d) or even the OUYA itself, I'm not entirely certain, but.. Beware, I guess!

I'm was about to fix this myself, by creating a toggle-watch thing that would take care of it, but thought I should report it, first, incase it's magically about to get fixed and break my toggle-watch!!


Sensei(Posted 2013) [#2]
I suspect that could be due to the way Ouya handles the menu button. Since you need to press it twice to exit a game, I guess it's a sort of timer. If you press the button twice within a certain time, it'll quit.
Maybe you can start a timer based on the initial toggle (are you wanting to use it to pause your game?)


computercoder(Posted 2013) [#3]
It is designed like that by OUYA. This is the expected behavior as OUYA explains in their documentation. There is no "timer" to it.

The JOY_MENU flag is meant to be used with JoyDown() and its supposed to act as a Toggle. This is so that you may use it to catch the possibility to see your own Menu show before popping out to the OUYA system menu. The early developers complained to OUYA about the lack of a real Menu/Back/Start type of button and practically begged them to give something to them. The result was this menu button tapping thing where you tap once to get the menu you customize and tap it twice to shoot out of the game/app to the OUYA main menu.

Rather than trying to make it overly complicated in Monkey, I asked Mark to just code it as a toggle. Yep. Blame me. I find the toggle idea pretty easy to deal with overall.

That said, all the rest of the JoyDown/JoyHit buttons should work as expected.

Additionally, if you have more than one controller running, you will know EXACTLY which controller has the Menu and you have the ability to control what happens if another controller attempts to press their button and what happens as a result.

The Menu button is explicitly for showing a menu you make for your game, much like the Start or Back buttons on other controllers do.