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


Java Table.setSize方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.setSize方法的具體用法?Java Table.setSize怎麽用?Java Table.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.Table的用法示例。


在下文中一共展示了Table.setSize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: MessageWindow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public MessageWindow(String message, BitmapFont font, float width, float height) {
    setTouchable(Touchable.enabled);
    setBounds(width / 2 - width / 4, height / 2 - height / 10, width / 2, height / 5);
    texture = new Texture("theme/basic/ui/Window.png");
    this.message = message;
    table = new Table();
    table.setSize(getWidth(), getHeight());
    table.align(Align.center | Align.top);
    table.setPosition(getX(), getY());
    Label label = new Label(message, new Label.LabelStyle(font, Color.BLACK));
    label.setWrap(true);
    label.setFontScale(0.7f);
    Label label2 = new Label("Tap to continue", new Label.LabelStyle(font, Color.BLACK));
    label2.setFontScale(0.6f);
    table.add(label).width(getWidth());
    table.row();
    table.add(label2).width(getWidth()).expandY();
    table.pad(0, 30, 0, 30);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:20,代碼來源:MessageWindow.java

示例2: initLoseStage

import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void initLoseStage() {
	
	setViewport(new ScreenViewport(getCamera()));
	getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	getViewport().apply(true);
	
	Label youLoseLbl = new Label("You lost" , Assets._skin , "fontVeraBd24" ,"white");
	playAgainBtn = new TextButton("Play Again", Assets._skin , "menu");
	mainMenuBtn = new TextButton("Main Menu", Assets._skin ,  "menu");
	Table container = new Table(Assets._skin);
	youLoseLbl.setColor(Color.RED);
	container.add(youLoseLbl).spaceBottom(100).row();
	container.add(playAgainBtn).align(Align.left).spaceBottom(20).row();
	container.add(mainMenuBtn).align(Align.left);
	container.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	container.setFillParent(true);
	addActor(container);
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:19,代碼來源:LoseStage.java

示例3: initWinStage

import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void initWinStage() {
	setViewport(new ScreenViewport(getCamera()));
	getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	getViewport().apply(true);
	
	Label youWinLabel = new Label("You Won!" , Assets._skin , "fontVeraBd24" , "white");
	playAgainBtn = new TextButton("Play Again", Assets._skin , "menu");
	mainMenuBtn = new TextButton("Main Menu", Assets._skin , "menu");
	Table container = new Table(Assets._skin);
	youWinLabel.setColor(Color.GREEN);
	container.add(youWinLabel).spaceBottom(100).row();
	container.add(playAgainBtn).align(Align.left).spaceBottom(20).row();
	container.add(mainMenuBtn).align(Align.left);
	container.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	container.setFillParent(true);
	addActor(container);
}
 
開發者ID:JoakimRW,項目名稱:ExamensArbeteTD,代碼行數:18,代碼來源:WinStage.java

示例4: 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


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