本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Table.row方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.row方法的具體用法?Java Table.row怎麽用?Java Table.row使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Table
的用法示例。
在下文中一共展示了Table.row方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createSkins
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
/**
* Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
* It also adds Listeners to the Skins' Buttons.
*
* @param table Table where the Skins' Labels and Buttons will be organized.
*/
private void createSkins(Table table) {
for (int i = 0; i < game.getNumSkins(); ++i) {
//Adding Buttons and Labels to the Arrays
skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
skinLabels.add(new Label("Current", skin1));
final int j = i; //Needed for Listener initialization
skinButtons.get(i).addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
setCurrentLabel(j);
}
});
table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
}
table.row();
for (int i = 0; i < game.getNumSkins(); ++i)
table.add(skinLabels.get(i));
initializeCurrentSkin();
}
示例2: AddWindowButton
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
final TextButton btn = new TextButton(buttonText, skin);
btn.addListener(new ChangeListener()
{
@Override
public void changed(ChangeEvent event, Actor actor)
{
if (window.isShowing())
window.hide();
else
window.show();
}
});
table.add(btn);
table.row();
}
示例3: addButtons
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void addButtons() {
buttonTable = new Table();
buttonTable.bottom();
buttonTable.setFillParent(true);
singlePlayer = new TextButton("\n Single Player \n", game.getSkin());
multiPlayer = new TextButton("\n Multi Player \n", game.getSkin());
achievements = new TextButton("\n Achievements \n", game.getSkin());
sign = new TextButton(game.getPlayServices().isSignedIn() ? " Sign Out " : " Sign In ", game.getSkin());
sign.setColor(game.SECONDARY_COLOR);
buttonTable.add(singlePlayer).center().padBottom(40);
buttonTable.row();
buttonTable.add(multiPlayer).center().padBottom(40);
buttonTable.row();
buttonTable.add(achievements).center().padBottom(40);
buttonTable.row();
buttonTable.add(sign).center().padBottom(40);
stage.addActor(buttonTable);
}
示例4: MessageWindow
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public MessageWindow(String message, BitmapFont font, float width, float height) {
setTouchable(Touchable.enabled);
setBounds(width / 2 - width / 4, height / 2 - height / 10, width / 2, height / 5);
texture = new Texture("theme/basic/ui/Window.png");
this.message = message;
table = new Table();
table.setSize(getWidth(), getHeight());
table.align(Align.center | Align.top);
table.setPosition(getX(), getY());
Label label = new Label(message, new Label.LabelStyle(font, Color.BLACK));
label.setWrap(true);
label.setFontScale(0.7f);
Label label2 = new Label("Tap to continue", new Label.LabelStyle(font, Color.BLACK));
label2.setFontScale(0.6f);
table.add(label).width(getWidth());
table.row();
table.add(label2).width(getWidth()).expandY();
table.pad(0, 30, 0, 30);
}
示例5: ScrollInventoryActor
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public ScrollInventoryActor(Inventory inventory, int slots) {
defaults().space(4f);
add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
row();
inner = new Table();
inner.defaults().space(4f);
for (int i = 0; i < inventory.itemStacks.length; i++) {
SlotActor slotActor = new SlotActor(inventory, i);
inner.add(slotActor);
if ((i + 1) % inventory.width == 0) {
inner.row();
}
}
inner.pack();
scrollPane = new ScrollPane(inner);
scrollPane.setScrollingDisabled(true, false);
add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
row();
pack();
}
示例6: addOptionsButtons
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void addOptionsButtons() {
buttonTable = new Table();
buttonTable.bottom();
buttonTable.setFillParent(true);
localGameButton = new TextButton("\n Local \n", game.getSkin());
onlineGameButton = new TextButton("\n Online \n", game.getSkin());
checkGamesButton = new TextButton("\n Check Games \n", game.getSkin());
backButton = new TextButton("Back", game.getSkin());
buttonTable.add(localGameButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(onlineGameButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(checkGamesButton).center().padBottom(40);
buttonTable.row();
buttonTable.add(backButton).center().padBottom(40);
backButton.setColor(Reversi.SECONDARY_COLOR);
stage.addActor(buttonTable);
}
示例7: 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);
}
示例8: ConsoleDialog
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public ConsoleDialog(UserInterface linkedInterface)
{
super("Console", Settings.DEFAULT_SKIN);
this.linkedInterface = linkedInterface;
setBounds(400, 700, 600, 150);
Button closeButton = new CloseButton(this);
getTitleTable().add(closeButton).size(15, 15).padRight(-5).top().right();
Table table = getContentTable();
inputTextField = new TextField("", getSkin());
inputTextField.addListener(new InputListener(){
@Override
public boolean keyDown(InputEvent event, int keycode)
{
if(!ConsoleDialog.this.isVisible())
inputTextField.setDisabled(true);
if(keycode == Keys.ENTER)
{
addMessageToList();
sendCommandToExecute();
}
return false;
}
});
consolePane = new ConsolePane();
table.add(consolePane).fillX();
table.row();
table.add(inputTextField).width(570).align(Align.bottom);
table.align(Align.bottom);
}
示例9: InventoryDialog
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public InventoryDialog(UserInterface linkedInterface, Integer linkedFieldGold)
{
super("Inventory", Settings.DEFAULT_SKIN);
this.linkedInterface = linkedInterface;
Button closeButton = new CloseButton(this);
getTitleTable().add(closeButton).size(15, 15).padRight(-5).top().right();
for (int i = 0; i < numberOfPages; i++)
inventoryPages.add(new InventoryPage(this, i));
currentPageButtons.addActor(inventoryPages.get(0));
addActor(currentPageButtons);
Table contentTable = this.getContentTable();
contentTable.add(currentPageButtons);
VerticalGroup switchButtons = new VerticalGroup().space(0).pad(0).top().padTop(-8).fill();
for (int i = 0; i < numberOfPages; i++)
{
InventoryTextField<Item> switchButton = createSwitchButton(i);
switchButtons.addActor(switchButton);
switchPageButtons.add(switchButton);
}
switchPageButtons.get(0).setColor(0.5f, 0.5f, 0.5f, 1);
contentTable.add(switchButtons);
contentTable.row();
goldLabel.setValue(linkedFieldGold);
goldLabel.update();
contentTable.add(goldLabel).left();
contentTable.row();
this.setX(1230);
this.setY(43);
this.pack();
}
示例10: EquipmentDialog
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public EquipmentDialog()
{
super("Equipment", Settings.DEFAULT_SKIN);
int padding = 10;
Table content = new Table(Settings.DEFAULT_SKIN);
content.add().pad(padding);
ButtonField<Item> helmetField = new ButtonField<Item>();
helmetField.setHeight(45);
helmetField.setWidth(45);
content.add(helmetField).pad(padding);;
content.add().pad(padding);;
content.row();
ButtonField<Item> weaponField = new ButtonField<Item>();
weaponField.setHeight(110);
weaponField.setWidth(45);
content.add(weaponField).pad(padding);;
ButtonField<Item> armorField = new ButtonField<Item>();
armorField.setHeight(110);
armorField.setWidth(55);
content.add(armorField).pad(padding);;
ButtonField<Item> shieldField = new ButtonField<Item>();
shieldField.setHeight(45);
shieldField.setWidth(45);
content.add(shieldField).pad(padding);;
content.row();
content.add().pad(padding);
ButtonField<Item> bootsField = new ButtonField<Item>();
bootsField.setWidth(45);
bootsField.setHeight(45);
content.add(bootsField).pad(padding);
content.add().pad(padding);
this.getContentTable().add(content).center().padLeft(-10).fill();
setX(1147);
setY(285);
setWidth(253);
setHeight(310);
}
示例11: ChatDialog
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public ChatDialog(UserInterface linkedInterface)
{
super("Chat", Settings.DEFAULT_SKIN);
this.linkedInterface = linkedInterface;
setBounds(0, 0, 400, 200);
Button closeButton = new CloseButton(this);
getTitleTable().add(closeButton).size(15, 15).padRight(-5).top().right();
Table table = getContentTable();
chatTextField = new TextField("", getSkin());
chatTextField.addListener(new InputListener(){
@Override
public boolean keyDown(InputEvent event, int keycode)
{
if(!ChatDialog.this.isVisible())
chatTextField.setDisabled(true);
if(keycode == Keys.ENTER)
sendMessage();
return false;
}
});
chatPane = new ChatPane();
table.add(chatPane).fillX();
table.row();
table.add(chatTextField).fillX().align(Align.bottom);
table.align(Align.bottom);
}
示例12: createMenu
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void createMenu() {
root = new Table();
root.setFillParent(true);
stage.addActor(root);
FileHandle fileHandle = Gdx.files.local(Core.DATA_PATH + "/data.json");
JsonReader reader = new JsonReader();
JsonValue val = reader.parse(fileHandle);
Label title = new Label(val.getString("title"), skin, "title");
root.add(title).padTop(50.0f).padBottom(75.0f);
root.row();
BouncingImage image = new BouncingImage(getCharacter());
root.add(image);
root.row();
ImageButton imageButton = new ImageButton(skin, "play");
root.add(imageButton).padTop(75.0f).expandY().top();
imageButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeListener.ChangeEvent event, Actor actor) {
getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/jump.wav", Sound.class).play();
showCharacterDialog();
}
});
}
示例13: SettingsTabbedPane
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
public SettingsTabbedPane(Skin skin, int x, int y, HashMap<TextButton, Table> componentMap) {
this.x = x;
this.y = y;
this.componentMap = componentMap;
baseTable = new Table();
buttonTable = new Table();
contentTable = new Table();
baseTable.add(buttonTable);
baseTable.row();
baseTable.add(contentTable);
this.setPosition(x / 2, y / 1.3f);
this.setActor(baseTable);
}
示例14: create_selectpart_texture
import com.badlogic.gdx.scenes.scene2d.ui.Table; //導入方法依賴的package包/類
private void create_selectpart_texture() {
// TODO Auto-generated method stub
Table container = new Table();
Table table = new Table();
container.setDebug(debug_pages);
table.setDebug(debug_pages);
container.setFillParent(true);
parts_scroll_pane = new ScrollPane(table);
container.add(parts_scroll_pane).width(screen_width).height(screen_height);
;
selectpart_stage.addActor(container);
for (int i = 1 ;i <=ajzaa_no ;i++){
GozaTap tablea = new GozaTap(i);
// tablea.setColor((float)Math.random(),(float)Math.random(),(float)Math.random(),1);
tablea.setDebug(debug_pages);
table.add(tablea).width(GozaTap.tab_width).height(GozaTap.tab_height+GozaTap.tab_pading_height);
table.row();
/*
selectpart_stage.addActor(new PageSeen(i));*/
}
}
示例15: 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);
}