本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java ImageTextButton.addListener方法的具体用法?Java ImageTextButton.addListener怎么用?Java ImageTextButton.addListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton
的用法示例。
在下文中一共展示了ImageTextButton.addListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initButtons
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; //导入方法依赖的package包/类
private void initButtons() {
buttonTexture = new Texture("buttons/button.png");
downButtonTexture = new Texture("buttons/button-down.png");
ImageTextButton.ImageTextButtonStyle style = new ImageTextButton.ImageTextButtonStyle();
style.font = buttonFont;
style.up = new SpriteDrawable(new Sprite(buttonTexture));
style.down = new SpriteDrawable(new Sprite(downButtonTexture));
startButton = new ImageTextButton(" Iniciar ", style);
stage.addActor(startButton);
startButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
// Evento do botão
game.setScreen(new GameScreen(game));
}
});
}
示例2: addGameButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; //导入方法依赖的package包/类
/**
* Fügt einen neuen Button für ein Spiel hinzu.
*
* @param gameObject
* Spiel Infos.
*/
private void addGameButton(final GameObject gameObject) {
ImageTextButton imgTextButton = new ButtonLarge(gameObject.getGameTitle(), ButtonColor.LIGHT_BROWN);
imgTextButton.addListener(new ChangeListener() {
public void changed(final ChangeEvent event, final Actor actor) {
Gdx.app.log("DEBUG", "Spiel " + gameObject.getGameTitle() + " soll gestartet werden");
GameManagerFactory.getInstance().navigateToLevel(gameObject.getLevelID());
}
});
verticalGroup.addActor(imgTextButton);
imgTextButton.setPosition(this.width / 2 - imgTextButton.getWidth() / 2, lastButtonY);
lastButtonY = (int) (lastButtonY - imgTextButton.getHeight());
stage.addActor(imgTextButton);
imgTextButton.toFront();
}
示例3: createButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; //导入方法依赖的package包/类
/**
* Diese Methode erzeugt einen Button.
*
* @param label
* Button Text
* @param inputListener
* {@link ChangeListener} um auf den Button Klick zu reagieren
* @return button
*/
private ImageTextButton createButton(final String label, final ChangeListener inputListener) {
ImageTextButton btn = new ButtonLarge(label, inputListener);
btn.addListener(inputListener);
this.addActor(btn);
return btn;
}
示例4: addButtonSpielListener
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton; //导入方法依赖的package包/类
/**
* Fügt einen Listener zu dem Button.
*
* @param button
* .
* @param saveGameID
* .
*/
private void addButtonSpielListener(final ImageTextButton button, final int saveGameID) {
button.addListener(new SavegameButtonListener(saveGameID, overlay));
}