You should be able to use a Stage
to manage your UI. To get input working correctly, you'll need to add an InputMultiplexer
so that the Stage
and then your current input scheme will both get the inputs.
To set it up, you'll do something like this:
InputMultiplexer multiplexer = new InputMultiplexer();
multiplexer.addProcessor(stage);
multiplexer.addProcessor(gameScreenInputProcessor);
Gdx.input.setInputProcessor(multiplexer);
(Code sample based on code from https://code.google.com/p/libgdx/wiki/InputEvent)
Note that the order is important (I'm guessing you'll want the stage to get events first to see if the UI is being touched or not). Also, the boolean return value from input event handlers are more important with a multiplexer, as "handled" events will not be propagated by the mutliplexer. UI events inside the Stage
have their own "handled" flag (mostly it does the right thing but there are some subtle differences).
One alternative to the InputMultiplexer
would be to create a "GameScreenActor" (a new subclass of Actor
) that contains your current game screen that you plug into the global Stage
. You'd have to move your input processing to the scene2d approach, though. This probably isn't the right choice for you, but it is a viable one.