本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}