当前位置: 首页>>代码示例>>Java>>正文


Java Table.setY方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.setY方法的典型用法代码示例。如果您正苦于以下问题:Java Table.setY方法的具体用法?Java Table.setY怎么用?Java Table.setY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.Table的用法示例。


在下文中一共展示了Table.setY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:tgobbens,项目名称:fluffybalance,代码行数:37,代码来源:Balanceball.java

示例2: 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);
}
 
开发者ID:tgobbens,项目名称:fluffybalance,代码行数:34,代码来源:IngameGuiEntity.java

示例3: LevelSelectScreen

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public LevelSelectScreen(final Hexpert hexpert)
{
    super();
    this.totalLevels = hexpert.levelIndex.size();
    this.hexpert = hexpert;
    this.batch = new SpriteBatch();
    this.displayBatch = new SpriteBatch();
    this.displayLevelCamera = new OrthographicCamera(Const.WIDTH, Const.HEIGHT);
    this.shapeRenderer = new ShapeRenderer();
    shapeRenderer.setAutoShapeType(true);
    this.objectiveTable = new Table();
    objectiveTable.setX(100);
    objectiveTable.setY(850);
    objectiveTable.defaults().pad(20);
    getStage().addActor(objectiveTable);
    goalCompleteCount = getGoalCompleteCount();

    String vertexShader = Gdx.files.internal("shaders/defaultvertex.vs").readString();
    String darkShader = Gdx.files.internal("shaders/darkness.fs").readString();
    String lockedShader = Gdx.files.internal("shaders/locked.fs").readString();

    shdDark = new ShaderProgram(vertexShader, darkShader);
    shdLckd = new ShaderProgram(vertexShader, lockedShader);

    if (!shdDark.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdDark.getLog());
    if (!shdLckd.isCompiled()) throw new GdxRuntimeException("Couldn't compile shader: " + shdLckd.getLog());

    getCamera().translate(450, 415);
    getCamera().update();

    createLevelSelectGrid();

    statsTable = new Table();
    statsTable.defaults().width(192).height(192);

    ImageButton btnGoldHex = new ImageButton(
            new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_CORRECT))));

    ImageButton btnAchievements = new ImageButton(
            new TextureRegionDrawable(new TextureRegion((Texture)hexpert.assetManager.get(TextureData.TEXTURE_ACHIEVEMENTS))));

    btnAchievements.addListener(new ClickListener()
    {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if(!hexpert.playServices.isSignedIn())
                hexpert.playServices.signIn();
            hexpert.playServices.showAchievementsUI();
        }
    });

    lblHexCount = new Label(String.format("x%d", goalCompleteCount), hexpert.getSkin());
    statsTable.add(btnGoldHex).width(100).height(100);
    statsTable.add(lblHexCount).width(80);
    statsTable.add(btnAchievements);
    statsTable.row();
    lblHighScore = new Label("", hexpert.getSkin());
    statsTable.add(lblHighScore).colspan(3);

    btnGoldHex.getImageCell().expand().fill();
    btnAchievements.getImageCell().expand().fill();

    statsTable.setX(1650);
    statsTable.setY(885);

    getStage().addActor(statsTable);
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:68,代码来源:LevelSelectScreen.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Table.setY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。