Example usage for com.badlogic.gdx.controllers Controller removeListener

List of usage examples for com.badlogic.gdx.controllers Controller removeListener

Introduction

In this page you can find the example usage for com.badlogic.gdx.controllers Controller removeListener.

Prototype

public void removeListener(ControllerListener listener);

Source Link

Document

Removes the given ControllerListener

Usage

From source file:com.badlogic.invaders.screens.GameOver.java

License:Apache License

public GameOver(Invaders invaders) {
    super(invaders);
    spriteBatch = new SpriteBatch();
    background = new Texture(Gdx.files.internal("data/planet.jpg"));
    background.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    logo = new Texture(Gdx.files.internal("data/title.png"));
    logo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), Gdx.files.internal("data/font16.png"), false);

    if (invaders.getController() != null) {
        invaders.getController().addListener(new ControllerAdapter() {
            @Override/*from   ww w .  j  a va 2s  .com*/
            public boolean buttonUp(Controller controller, int buttonIndex) {
                controller.removeListener(this);
                isDone = true;
                return false;
            }
        });
    }
}

From source file:com.badlogic.invaders.screens.MainMenu.java

License:Apache License

public MainMenu(Invaders invaders) {
    super(invaders);

    spriteBatch = new SpriteBatch();
    background = new Texture(Gdx.files.internal("data/planet.jpg"));
    background.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    logo = new Texture(Gdx.files.internal("data/title.png"));
    logo.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), Gdx.files.internal("data/font16.png"), false);

    if (invaders.getController() != null) {
        invaders.getController().addListener(new ControllerAdapter() {
            @Override/*from   w ww  .j ava 2s  . c  o  m*/
            public boolean buttonUp(Controller controller, int buttonIndex) {
                controller.removeListener(this);
                isDone = true;
                return false;
            }
        });
    }
}