package eu.jonahbauer.wizard.client.libgdx.listeners;

import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.Button;

public class ButtonKeyListener extends InputListener {

    @Override
    public boolean keyTyped(InputEvent event, char character) {
        if ((character == '\n' || character == ' ') && event.getTarget() instanceof Button button) {
            button.toggle();
            return true;
        }
        return false;
    }
}
