當前位置: 首頁>>代碼示例>>Java>>正文


Java Table.center方法代碼示例

本文整理匯總了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);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:28,代碼來源:DebugScreen.java

示例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;
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:30,代碼來源:TutorialStage.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Table.center方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。