I'm trying to detect when a Group actor (my "slot") on my stage is clicked by add an InputerListener to the group. I've added the stage to my InputMultiplexer, but when I click on the actor, nothing happens.
Relevant code from the main Screen:
InputMultiplexer inputMultiplexer = new InputMultiplexer();
Stage stage = new Stage();
inputMultiplexer.addProcessor(stage);
Gdx.input.setInputProcessor(inputMultiplexer);
From the Group class:
Label amountLabel = new Label("", GameScreen.labelStyle);
Image itemImage = new Image();
Image slotImage = new Image(new TextureRegionDrawable(new TextureRegion(new Texture("Slot.png"))));
public SlotGroup() {
this.addActor(amountLabel);
this.addActor(itemImage);
this.addActor(slotImage);
this.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
System.out.println("Hello world");
return true;
}
});
this.setStage(Screen.stage);
}