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