My game's main game class is a Screen which also implements InputProcessor to handle touch events.

The screen renders a TMX map using an HexagonalMapRenderer and a Camera, like this:

_camera = new OrthographicCamera();
_map = new TmxMapLoader().load("1087.tmx");
_mapRenderer = new HexagonalTiledMapRenderer(_map);
_camera.setToOrtho(false, Gdx.graphics.getWidth(),  Gdx.graphics.getHeight());

To allow the user to scroll the map, I am overriding the touchDown and touchDragged methods; it works.

However, I also have a Scene2D Stage rendering on the Screen, which I use to display some buttons.

They get displayed. and I have created a ClickListener like this:

 button.addListener(new ClickListener(){

    public void clicked(InputEvent e, float x, float y){

If I use


Only the Screen scrolling functions will work, and the buttons will become unresponsive.

On the other hand, if I use:


I will be able to use UI buttons, but the map will become unresponsive.

I'd like to enable both (map will scroll if user clicks anywhere BUT the UI buttons, it will then fire the button clicked listener), is there any way to do this?



1 Answer 1


You should use an InputMultiplexer (javadocs | wiki) to combine the two input processors. It works like this:

InputMultiplexer multiplexer = new InputMultiplexer(this, stage);

This will allow you to use both processors at once. Remember that the return value of the functions are important (true / false)! If once function (let's say touchDragged) return true no other input processors will be called afterwards! The call order of the processors depends on the order you provide them:

InputMultiplexer multiplexer = new InputMultiplexer(this, stage);

yields different results, than

InputMultiplexer multiplexer = new InputMultiplexer(stage, this);

In the later example, the stage is called first, so it has a "chance" to any processed inputEvent.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .