当前位置: 首页>>代码示例>>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;未经允许,请勿转载。