本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}