本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.center方法的典型用法代码示例。如果您正苦于以下问题:Java Table.center方法的具体用法?Java Table.center怎么用?Java Table.center使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.center方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
@Override
public void show() {
super.show();
background = new Texture("theme/basic/ui/Window.png");
final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.font = game.getFonts().get("moonhouse64");
textButtonStyle.up = new TextureRegionDrawable(new TextureRegion(background));
Table table = new Table();
table.setSize(viewport.getWorldWidth(), viewport.getWorldHeight());
//Unlock achievement button
TextButton achievementButton = new TextButton("Unlock Achievement", textButtonStyle);
achievementButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if(TDGalaxy.onlineServices != null)
TDGalaxy.onlineServices.unlockAchievement(Constants.ACHIEVEMENT_NO_LIFE);
}
});
table.add(achievementButton);
table.center();
stage.addActor(table);
}
示例2: createControlsTable
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Table createControlsTable(){
Table escTable = new Table(Assets._skin);
Table keyTable = new Table(Assets._skin);
Table table = new Table(Assets._skin);
Image keyW = new Image(Assets._skin , "keyW");
Image keyA = new Image(Assets._skin , "keyA");
Image keyS = new Image(Assets._skin , "keyS");
Image keyD = new Image(Assets._skin , "keyD");
Image keyESC = new Image(Assets._skin , "keyESC");
keyTable.add(new Label("Controls" , Assets._skin , "fontVeraBd24" , "white")).colspan(5).spaceBottom(40f).align(Align.center).row();
keyTable.add(new Label("[W] Move camera Up" , Assets._skin , "default-font" , "green")).padBottom(10f).padRight(8f).colspan(5).align(Align.center).row();
keyTable.add(keyW).padRight(8f).colspan(5).spaceBottom(5f).align(Align.center).row();
keyTable.add(new Label("[A] Move camera Left" , Assets._skin , "default-font" , "green")).padRight(10f);
keyTable.add(keyA).spaceRight(5f);
keyTable.add(keyS);
keyTable.add(keyD).spaceLeft(5f);
keyTable.add(new Label("[D] Move camera Right" , Assets._skin , "default-font" , "green")).padLeft(10f).row();
keyTable.add(new Label("[S] Move camera Down" , Assets._skin , "default-font" , "green")).colspan(5).align(Align.center).padTop(10f);
escTable.add(new Label("[Esc] Pause game", Assets._skin , "default-font" , "green")).padBottom(10f).row();
escTable.add(keyESC);
table.add(keyTable);
table.add(escTable).spaceBottom(20f).row();
table.add(backBtn).align(Align.bottom).padTop(50f);
table.setFillParent(true);
table.center();
return table;
}