本文整理匯總了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);
}
}