Search code examples
androidlibgdx

libGDX MENU button


I have a game, in which are some function buttons, which defined as ImageButtons. I have some other shapes, which are Sprites. On each type of elements have own type of listeners. I set active function buttons' Stage by MENU button. It isn't practical, because newer devices haven't MENU button.

@Override
public boolean keyDown(int keycode) {
    if ((keycode == Keys.M) || (keycode == Keys.MENU)) {
       // some code
}

What do you think, how can I replace this "method"?


Solution

  • I have solved this with use of InputMultiplexer. It is really easy to use and do the trick. You should implement like this:

    public InputMultiplexer(InputProcessor... processors)