本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.top方法的典型用法代码示例。如果您正苦于以下问题:Java Table.top方法的具体用法?Java Table.top怎么用?Java Table.top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.top方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initHUD
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
/**
* Function used to initialize all the elements of the HUD and add the respective Listeners.
*/
private void initHUD() {
Table hudTable = new Table();
hudTable.setFillParent(true);
Button pauseButton = new Button(new TextureRegionDrawable(
new TextureRegion(game.getAssetManager().get("pause.png", Texture.class))));
scoreText = new Label("0:00", skin);
scoreText.setFontScale(FONT_SCALE, FONT_SCALE);
pauseButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
model.togglePause();
}
});
hudTable.top();
hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX()
.left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill()
.padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
this.addActor(hudTable);
}
示例2: show
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void show() {
super.show();
// Table containing the Level Buttons
Table levels = new Table();
levels.top();
levels.padTop(TOP_EDGE);
createLevelButtons(levels);
// Table containing the Static Elements
Table staticElements = new Table();
staticElements.setFillParent(true);
createStaticElements(staticElements, levels);
stage.addActor(staticElements);
Gdx.input.setInputProcessor(stage);
}
示例3: HudScene
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public HudScene(SpriteBatch batch, ShapeRenderer shapeRenderer, ArcRenderer arcRenderer) {
this.batch = batch;
stage = new Stage();
VisUI.load();
Table table = new Table();
table.top();
table.setFillParent(true);
scoreLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
setScore(score);
balanceLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
setBalance(balance);
table.add(scoreLabel).align(Align.left).expandX();
table.add(balanceLabel).align(Align.right).expandX();
stage.addActor(table);
ringButton = new RingButton(shapeRenderer, arcRenderer);
ringButton.setBounds(10, 10, 100, 100);
stage.addActor(ringButton);
}
示例4: Hud
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Hud(SpriteBatch sb) {
countKill = 0;
viewport = new FitViewport(ScreenConf.V_WIDTH, ScreenConf.V_HEIGHT, new OrthographicCamera());
stage = new Stage(viewport, sb);
Table table = new Table();
table.setFillParent(true);
table.top();
countKillLabel = new Label(String.format("%03d", countKill), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(countKillLabel).expandX().padTop(10);
table.add().expandX();
table.add().expandX();
table.add().expandX();
stage.addActor(table);
}
示例5: 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));
}
示例6: Hud
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Hud(SpriteBatch sb) {
worldTimer = 300;
timeCount = 0;
score = 0;
viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
stage = new Stage(viewport, sb);
Table table = new Table();
table.top();
table.setFillParent(true);
// countDownLabel = new Label(String.format("%03d", worldTimer), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
// scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
// timeLabel = new Label("TIME", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
// levelLabel = new Label("1-1", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
// worldLabel = new Label("WORLD", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
// dudeLabel = new Label("DUDE", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(dudeLabel).expandX().padTop(10);
table.add(worldLabel).expandX().padTop(10);
table.add(timeLabel).expandX().padTop(10);
table.row();
table.add(scoreLabel).expandX();
table.add(levelLabel).expandX();
table.add(countDownLabel).expandX();
stage.addActor(table);
}
示例7: PlayScreen
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public PlayScreen(NoObjectionGame game) {
atlas = new TextureAtlas("dudestuff3.pack");
this.game = game;
bg = new Texture("main_background.png");
gameCam = new OrthographicCamera();
gamePort = new FitViewport(NoObjectionGame.V_WIDTH / NoObjectionGame.PPM, NoObjectionGame.V_HEIGHT / NoObjectionGame.PPM, gameCam);
hud = new Hud(game.batch);
maploader = new TmxMapLoader();
map = maploader.load("map1.tmx");
renderer = new OrthoCachedTiledMapRenderer(map, 1 / NoObjectionGame.PPM);
gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);
world = new World(new Vector2(0, -10), true);
b2dr = new Box2DDebugRenderer();
new B2WorldCreator(world, map);
hero = new Hero(world, this);
controller = new Controller();
worldContactListener = new WorldContactListener();
world.setContactListener(worldContactListener);
//timer
sb = new SpriteBatch();
viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
stage = new Stage(viewport, sb);
table = new Table();
table.top();
table.setFillParent(true);
countDownLabel = new Label(Float.toString(playTime), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(countDownLabel).expandX();
stage.addActor(table);
}
示例8: addTitle
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void addTitle() {
mainTitle = new Label(" Retro \nReversi", game.getSkin());
mainTitle.setFontScale(2);
titleTable = new Table();
titleTable.setFillParent(true);
titleTable.top();
titleTable.add(mainTitle).expandX().padTop(100);
stage.addActor(titleTable);
}
示例9: addTitle
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void addTitle() {
mainTitle = new Label(" Multiplayer ", game.getSkin());
mainTitle.setFontScale(1);
titleTable = new Table();
titleTable.setFillParent(true);
titleTable.top();
titleTable.add(mainTitle).center().padTop(120);
stage.addActor(titleTable);
}
示例10: addTitle
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void addTitle() {
mainTitle = new Label("Difficulty", game.getSkin());
mainTitle.setFontScale(2);
titleTable = new Table();
titleTable.setFillParent(true);
titleTable.top();
titleTable.add(mainTitle).center().padTop(70);
stage.addActor(titleTable);
}
示例11: Hud
import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public Hud(SpriteBatch sb) {
score = 0;
viewport = new FitViewport(FlappyChapa.WIDTH/2, FlappyChapa.HEIGHT/2, new OrthographicCamera());
stage = new Stage(viewport,sb);
Table table = new Table();
table.top();
table.setFillParent(true);
scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
scoreTextLabel = new Label("SCORE", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
table.add(scoreTextLabel);
table.add(scoreLabel);
stage.addActor(table); }