本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.pad方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.pad方法的具體用法?Java Table.pad怎麽用?Java Table.pad使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.pad方法的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: MenuScreen
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public MenuScreen(MainGameClass game) {
this.game = game;
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("skins/Flat_Earth_UI_Skin/flatearthui/flat-earth-ui.json"));
progressBarStyle = skin.get("fancy", ProgressBar.ProgressBarStyle.class);
TiledDrawable tiledDrawable = skin.getTiledDrawable("slider-fancy-knob").tint(skin.getColor("selection"));
tiledDrawable.setMinWidth(0);
progressBarStyle.knobBefore = tiledDrawable;
sliderStyle = skin.get("fancy", Slider.SliderStyle.class);
sliderStyle.knobBefore = tiledDrawable;
layoutTable = new Table();
layoutTable.top();
layoutTable.setFillParent(true);
layoutTable.pad(getPixelSizeFromDensityIndependentPixels(50));
}
示例3: initGuiInGame
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void initGuiInGame() {
mGuiStage = new Stage(new ScreenViewport());
Table gameScore = new Table();
if (DEBUG_RENDERER) {
gameScore.debug();
}
float scorePanelWidth = Gdx.graphics.getWidth() * 0.8f; // 80 % of screen
float scorePanelHeight = Gdx.graphics.getHeight() * 0.2f; // 20 % of screen
gameScore.setWidth(scorePanelWidth);
gameScore.setHeight(scorePanelHeight);
gameScore.setY(Gdx.graphics.getHeight() - (scorePanelHeight + 30.f));
gameScore.setX((Gdx.graphics.getWidth() - scorePanelWidth) * 0.5f);
gameScore.setBackground(new NinePatchDrawable(
new NinePatch(new Texture(Gdx.files.internal("red_button13.png")), 24, 24, 24, 24)));
gameScore.pad(32.f);
Label scoreLabel = new Label("Score", new Label.LabelStyle(
mDefaultFont, COLOR_FONT));
scoreLabel.setFontScale(1.2f);
gameScore.add(scoreLabel).expand();
gameScore.row();
mScoreLabel = new Label("" + mPointTotal, new Label.LabelStyle(
mDefaultFont, COLOR_FONT));
mScoreLabel.setFontScale(2.0f);
gameScore.add(mScoreLabel).expand();
mGuiStage.addActor(gameScore);
}
示例4: create
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public void create() {
Stage stage = new Stage(new ScreenViewport());
getComponentByType(GuiComponent.class).stage = stage;
Table gameScore = new Table();
float scorePanelWidth = Gdx.graphics.getWidth() * 0.8f; // 80 % of screen
float scorePanelHeight = Gdx.graphics.getHeight() * 0.2f; // 20 % of screen
gameScore.setWidth(scorePanelWidth);
gameScore.setHeight(scorePanelHeight);
gameScore.setY(Gdx.graphics.getHeight() - (scorePanelHeight + 30.f));
gameScore.setX((Gdx.graphics.getWidth() - scorePanelWidth) * 0.5f);
gameScore.setBackground(new NinePatchDrawable(
new NinePatch(new Texture(Gdx.files.internal("red_button13.png")), 24, 24, 24, 24)));
gameScore.pad(32.f);
Label scoreLabel = new Label("Score", new Label.LabelStyle(
mFont, COLOR_FONT));
scoreLabel.setFontScale(1.2f);
gameScore.add(scoreLabel).expand();
gameScore.row();
mScoreLabel = new Label("" + 0, new Label.LabelStyle(mFont, COLOR_FONT));
mScoreLabel.setFontScale(2.0f);
gameScore.add(mScoreLabel).expand();
stage.addActor(gameScore);
}