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


Java Table.setBackground方法代码示例

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


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

示例1: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private Table setupRedDiceOption(int diceNumber) {
    Table redDiceOption = new Table();
    redDiceOption.setBackground(redBackground);
    
    redDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    redDiceOption.setTouchable(Touchable.enabled); 
    redDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenRedDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenRedDice = 0;
                enableAllTouchablesRed();
            } else {
                System.out.println("choose " + diceNumber);
                chosenRedDice = diceNumber;
                disableAllTouchablesRed();
                redDiceOption.setTouchable(Touchable.enabled);
                redDiceOption.setBackground(redBackground);
            }
        }
    });
    
    return redDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例2: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private Table setupYellowDiceOption(int diceNumber) {
    Table yellowDiceOption = new Table();
    yellowDiceOption.setBackground(yellowBackground);
    
    yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    yellowDiceOption.setTouchable(Touchable.enabled); 
    yellowDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenYellowDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenYellowDice = 0;
                enableAllTouchablesYellow();
            } else {
                System.out.println("choose " + diceNumber);
                chosenYellowDice = diceNumber;
                disableAllTouchablesYellow();
                yellowDiceOption.setTouchable(Touchable.enabled);
                yellowDiceOption.setBackground(yellowBackground);
            }
        }
    });
    
    return yellowDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

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

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

示例5: WinnerWindow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
public WinnerWindow(String title, Skin skin, Player opponent) {
    super(title, skin);

    final Table TextTable = new Table(skin);

    width = 300;
    height = 1f / 5f * Gdx.graphics.getHeight() ;
    setWidth(width);
    setHeight(height);

    Label winnerLabel = new Label(opponent.getAccount().getUsername(), skin);
    switch (opponent.getColor()) {
        case BLUE:
            TextTable.setBackground(CatanGame.skin.newDrawable("white", Color.BLUE));
            break;
        case ORANGE:
            TextTable.setBackground(CatanGame.skin.newDrawable("white", Color.ORANGE));
            break;
        case RED:
            TextTable.setBackground(CatanGame.skin.newDrawable("white", Color.RED));
            break;
        case WHITE:
            TextTable.setBackground(CatanGame.skin.newDrawable("white", Color.WHITE));
            break;
        case YELLOW:
            TextTable.setBackground(CatanGame.skin.newDrawable("white", Color.YELLOW));
            break;
        default:
            break;
    }
    TextTable.add(winnerLabel).padLeft(5).padRight(5).padTop(10).padBottom(20).row();

    Button quitButton = new TextButton("Quit", CatanGame.skin);
    quitButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            close();
    }});

    add(TextTable).size(100,40).pad(20).row();
    add(quitButton).row();

    setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
    setMovable(true);

}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:47,代码来源:WinnerWindow.java

示例6: disableAllTouchablesRed

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void disableAllTouchablesRed() {
    for (Table t : redDieOptions) {
        t.setBackground(redBackgroundClicked);
        t.setTouchable(Touchable.disabled);
    }
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:7,代码来源:ChooseDiceResultWindow.java

示例7: enableAllTouchablesRed

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void enableAllTouchablesRed() {
    for (Table t : redDieOptions) {
        t.setBackground(redBackground);
        t.setTouchable(Touchable.enabled);
    }
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:7,代码来源:ChooseDiceResultWindow.java

示例8: disableAllTouchablesYellow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void disableAllTouchablesYellow() {
    for (Table t : yellowDieOptions) {
        t.setBackground(yellowBackgroundClicked);
        t.setTouchable(Touchable.disabled);
    }
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:7,代码来源:ChooseDiceResultWindow.java

示例9: enableAllTouchablesYellow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入方法依赖的package包/类
private void enableAllTouchablesYellow() {
    for (Table t : yellowDieOptions) {
        t.setBackground(yellowBackground);
        t.setTouchable(Touchable.enabled);
    }
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:7,代码来源:ChooseDiceResultWindow.java


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