本文整理匯總了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;
}