本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java TextButton.setPosition方法的具体用法?Java TextButton.setPosition怎么用?Java TextButton.setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.TextButton
的用法示例。
在下文中一共展示了TextButton.setPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createComponents
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void createComponents()
{
btBackToMainMenu = new TextButton("Back to Main Menu", skin);
btBackToMainMenu.center();
btBackToMainMenu.setWidth(600);
btBackToMainMenu.setHeight(80);
btBackToMainMenu.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
AL.getGame().setScreen(AL.getScreenManager().get(MainMenuScreen.class));
}
});
btBackToMainMenu.setPosition(1920 / 2 - 300, 1080 / 2 + 40);
stage.addActor(btBackToMainMenu);
endgameLabel = new Label(endgameText, skin);
endgameLabel.setWidth(600);
endgameLabel.setHeight(80);
endgameLabel.setAlignment(Align.center);
endgameLabel.setPosition(1920 / 2 - 300, 1080 / 1.5f);
stage.addActor(endgameLabel);
}
示例2: init
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void init() {
// Make the window around 3/4 of the screen
setSize(width, height);
// Position window in the middle
setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
// Center title
getTitleLabel().setAlignment(Align.center);
// Create the close button
if (getTitleLabel().getText().length != 0) {
closeButton = new TextButton("X", getSkin());
closeButton.setSize(20, 20);
closeButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
closeButton.setChecked(false);
close();
}
});
getTitleTable().addActor(closeButton);
closeButton.setPosition(getWidth() - closeButton.getWidth() - 5, 0);
}
getTitleTable().getCells().get(0).expandY().fillY();
setMovable(false);
setModal(true);
row();
}
示例3: PlayGroup
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public PlayGroup(Client client) {
play = new TextButton("Play", Assets.SKIN);
play.setSize(200, 40);
play.setPosition((Gdx.graphics.getWidth() - play.getWidth()) / 2, Gdx.graphics.getHeight() / 8);
port = new NumberField(null, Assets.SKIN);
port.setPosition(play.getX(), play.getY() + port.getHeight() * 1.1f);
port.setBounds(port.getX(), port.getY(), play.getWidth(), play.getHeight());
host = new TextField(null, Assets.SKIN);
host.setSize(200, 40);
host.setPosition(play.getX(), port.getY() + host.getHeight() * 1.1f);
hostLabel = new ConquestLabel("Host:", host.getX() - 75, host.getY() - 5, 50, 50);
portLabel = new ConquestLabel("Port:", hostLabel.getX(), port.getY() - 5, 50, 50);
server = new ConquestLabel("Failed to connect.", play.getX(), host.getY() + 75, 200, 1);
server.setVisible(false);
play.addCaptureListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
try {
client.connect(host.getText(), port.getValue());
} catch (IOException io) {
server.setVisible(true);
Timer.schedule(new Timer.Task() {
@Override
public void run() {
server.setVisible(false);
}
}, 1);
}
}
});
addActor(play);
addActor(port);
addActor(portLabel);
addActor(host);
addActor(hostLabel);
addActor(server);
}
示例4: setupUIManager
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
@Override
public void setupUIManager(String skinPath) {
// create new uiManager and skin
super.setupUIManager(skinPath);
// after we have uiManager, skin, uiCamera...
// Add some stuffs to uiManager
btnStartWave = new TextButton("Unleash Monster!", skin);
btnStartWave.setWidth(150);
btnStartWave.setPosition(
Gdx.graphics.getWidth() - btnStartWave.getWidth(), 0);
btnStartWave.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
level.setEnabled(!level.isEnabled());
player.setEnabled(level.isEnabled());
if (level.isEnabled()) {
btnStartWave.setText("Pause Game");
} else {
btnStartWave.setText("Unleash Monsters!");
}
}
});
uiManager.addActor(btnStartWave);
lblPlayerGold = new Label("Gold: ", skin);
lblPlayerGold.setColor(Color.CYAN);
lblPlayerGold.setPosition(0,
Gdx.graphics.getHeight() - lblPlayerGold.getHeight());
uiManager.addActor(lblPlayerGold);
lblPlayerLives = new Label("Gold: ", skin);
lblPlayerLives.setColor(Color.CYAN);
lblPlayerLives.setPosition(
Gdx.graphics.getWidth() - btnStartWave.getWidth(),
Gdx.graphics.getHeight() - lblPlayerLives.getHeight());
uiManager.addActor(lblPlayerLives);
gameDialog = new GameDialog(skin){
@Override
public void restartGame() {
initialize();
}
};
gameDialog.setVisible(false);
uiManager.addActor(gameDialog);
}