Example usage for com.badlogic.gdx.scenes.scene2d.ui Table background

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Table background

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui Table background.

Prototype

Drawable background

To view the source code for com.badlogic.gdx.scenes.scene2d.ui Table background.

Click Source Link

Usage

From source file:com.ladinc.core.screens.GameScreenLobby.java

License:Creative Commons License

private Table displayCredits() {
    Table creditsTable = new Table();

    Image card = new Image(creditsSprite.getTexture());
    creditsTable.background(card.getDrawable());

    //creditsTable.background(credits);

    creditsTable.add(new Label("Credits", new Label.LabelStyle(titleFont, Color.ORANGE))).padBottom(20f);
    creditsTable.row();// w  ww.  j  ava  2  s .  c o  m
    creditsTable.add(new Label("Developers", new Label.LabelStyle(smallFont, Color.GREEN)));
    creditsTable.row();
    creditsTable.add(new Label("Brian Lough", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Kieran Nestor", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Gary Cregan", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Paul O'Flaherty", new Label.LabelStyle(smallFont, Color.WHITE)));

    creditsTable.row();
    creditsTable.add(new Label("Artwork", new Label.LabelStyle(smallFont, Color.GREEN))).padTop(30f);
    creditsTable.row();
    creditsTable.add(new Label("Buttons & Icons - kenney.nl", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Background (Modified) - laurakerbyson.com",
            new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Written In Libgdx", new Label.LabelStyle(smallFont, Color.WHITE))).padTop(30f);
    creditsTable.row();

    creditsTable
            .add(new Label("Source Code of Game availalbe at:", new Label.LabelStyle(smallFont, Color.WHITE)))
            .padTop(25f);
    creditsTable.row();
    creditsTable.add(new Label("mcp.rocks/mao", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("CAH cards used under the Creative Commons License",
            new Label.LabelStyle(smallFont, Color.WHITE))).padTop(25f);
    creditsTable.row();

    if (closeCreditsButton == null) {

        TextButtonStyle style = new TextButtonStyle(); //** Button properties **//
        style.up = buttomDrawable;
        style.down = buttomPressedDrawable;
        style.font = smallFont;
        style.fontColor = Color.GRAY;

        String buttonText = "Close";

        if (this.game.gcm.useOptionButtonText) {
            buttonText = buttonText + " " + this.game.gcm.backButtonText;
        }

        closeCreditsButton = new TextButton(buttonText, style);

        closeCreditsButton.setBounds(closeCreditsButton.getX(), closeCreditsButton.getY(),
                closeCreditsButton.getWidth(), closeCreditsButton.getHeight());

        closeCreditsButton.addListener(new InputListener() {
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                displayCredits = false;
                return true;
            }
        });

        closeCreditsButton.padLeft(8f);
        closeCreditsButton.padRight(8f);
        closeCreditsButton.padTop(5f);
        closeCreditsButton.padBottom(5f);
    }

    creditsTable.add(closeCreditsButton).padTop(30f).padBottom(20f);

    creditsTable.setPosition(screenWidth / 2 - creditsSprite.getWidth() / 2,
            screenHeight / 2 - creditsSprite.getHeight() / 2);

    //creditsSprite.setPosition(screenWidth/2 - creditsSprite.getWidth()/2, screenHeight/2 -  creditsSprite.getHeight()/2);

    //      spriteBatch.begin();
    //      creditsSprite.draw(spriteBatch);
    //      creditsTable.draw(spriteBatch, 1);
    //      spriteBatch.end();

    creditsTable.pack();

    return creditsTable;
}

From source file:com.ore.infinium.HotbarInventoryView.java

License:Open Source License

public HotbarInventoryView(Stage stage, Skin skin, Inventory hotbarInventory, Inventory inventory,
        DragAndDrop dragAndDrop, OreClient client) {
    m_skin = skin;//from w w w  .  java 2  s.  c om
    m_inventory = inventory;
    m_client = client;
    m_stage = stage;

    m_hotbarInventory = hotbarInventory;
    //attach to the inventory model
    m_hotbarInventory.addListener(this);

    container = new Table(m_skin);
    container.setFillParent(true);
    container.top().left().setSize(800, 100);
    container.padLeft(10).padTop(10);

    container.defaults().space(4);

    stage.addActor(container);

    Image dragImage = new Image();
    dragImage.setSize(32, 32);

    for (byte i = 0; i < Inventory.maxHotbarSlots; ++i) {

        Image slotImage = new Image();

        SlotElement element = new SlotElement();
        m_slots[i] = element;

        element.itemImage = slotImage;

        Table slotTable = new Table(m_skin);
        element.table = slotTable;
        slotTable.setTouchable(Touchable.enabled);
        slotTable.addListener(new SlotClickListener(this, i));
        slotTable.addListener(new SlotInputListener(this, i));

        slotTable.add(slotImage);
        slotTable.background("default-pane");

        slotTable.row();

        Label itemCount = new Label(null, m_skin);
        slotTable.add(itemCount).bottom().fill();
        element.itemCountLabel = itemCount;

        //            container.add(slotTable).size(50, 50);
        container.add(slotTable).fill().size(50, 50);
        setHotbarSlotVisible(i, false);

        dragAndDrop.addSource(new HotbarDragSource(slotTable, i, dragImage, this));

        dragAndDrop.addTarget(new HotbarDragTarget(slotTable, i, this));
    }

    m_tooltip = new Label(null, m_skin);
    stage.addActor(m_tooltip);
}

From source file:com.theosirian.ppioo.controllers.PlayerSelectionController.java

License:Open Source License

@Override
protected void buildUI() {
    rootLayout.clear();//from   w  ww  . j a  v  a 2  s . co  m

    rootLayout.add(titleLabel).pad(8).expandX().fill().row();

    Table selectionButtonsTable = new Table();
    selectionButtonsTable.background(game.skin.newDrawable("white", Color.GRAY));
    selectionButtonsTable.add(randomizePlayersButton).pad(8, 8, 4, 4).expandX().fillX().uniformX();
    selectionButtonsTable.add(playerSortButton).pad(8, 8, 4, 4).expandX().fillX().uniformX();
    selectionButtonsTable.add(randomizePositionsButton).pad(8, 8, 4, 4).expandX().fillX().uniformX();
    selectionButtonsTable.add(positionSortButton).pad(8, 4, 4, 8).expandX().fillX().uniformX();
    selectionButtonsTable.row();

    rootLayout.add(selectionButtonsTable).expandX().fill().row();

    Table panelsTable = new Table();
    panelsTable.background(game.skin.newDrawable("white", Color.GRAY));
    buildPlayerPane(game.data.getOwnedPlayers());
    panelsTable.add(playersPane).pad(4, 8, 8, 4).expand().fill().uniformX();
    buildPlayerSetupList(game.data.getTeam());
    panelsTable.add(positionsPane).pad(4, 4, 8, 8).expand().fill().uniformX();
    panelsTable.row();

    rootLayout.add(panelsTable).expand().fill().row();

    Table buttonTable = new Table();

    buttonTable.add(backButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();
    buttonTable.add(helpButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();
    buttonTable.add(clearButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();
    buttonTable.add(proceedButton).pad(8, 4, 8, 8).expandX().fillX().uniformX();

    rootLayout.add(buttonTable).expandX().fill().row();
}

From source file:com.theosirian.ppioo.controllers.ShopController.java

License:Open Source License

@Override
protected void buildUI() {
    rootLayout.clear();/* ww  w.ja  va  2s.co m*/

    buildPlayerList();

    moneyLabel.setText("Money: $" + game.data.getMoney());

    Table titleTable = new Table();
    titleTable.add(titleLabel).expandX().left();
    titleTable.add(moneyLabel).expandX().right();

    rootLayout.add(titleTable).pad(16).expandX().fill().row();

    Table panelsTable = new Table();
    panelsTable.background(game.skin.newDrawable("white", Color.GRAY));
    panelsTable.add(playerList).pad(4, 8, 8, 4).expand().fill().uniformX();
    buildFanList(game.data.getNotOwnedFans());
    panelsTable.add(fansPane).pad(4, 4, 8, 8).expand().fill().uniformX();
    panelsTable.row();

    rootLayout.add(panelsTable).expand().fill().row();

    Table buttonTable = new Table();

    buttonTable.add(backButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();
    buttonTable.add(playerSortButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();
    buttonTable.add(fanSortButton).pad(8, 8, 8, 4).expandX().fillX().uniformX();

    rootLayout.add(buttonTable).expandX().fillX().row();
}