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

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

Introduction

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

Prototype

public Table(String name) 

Source Link

Usage

From source file:com.digitale.screens.ShipScreen.java

License:Open Source License

private Table initGridEquipment() {

    System.out.println("init equip ");
    final Table gridEquip = new Table("gridequipment");
    if (Stardust3d.DEBUG)
        gridEquip.debug();/*from  w w  w . j  a v a  2s  .c  o  m*/
    String itemIcon;

    for (int x = 0; x < Stardust3d.myInventory.size(); x++) {
        System.out.println("init equip id " + x + "item id " + Stardust3d.myInventory.get(x).getInventoryid());
        final Inventory item = Stardust3d.myInventory.get(x);
        itemIcon = "data/" + item.getIcon() + ".png";

        for (int offSlots = 0; offSlots < 5; offSlots++) {
            if (item.getInventoryid() == Stardust3d.myFitting.offList.get(offSlots)) {
                if (Stardust3d.DEBUG) {
                    System.out.println("equip icon " + itemIcon);
                }
                String uidString = "" + item.getInventoryid();
                final Image newItem = new Image(
                        new TextureRegion(InventoryIcon.generateDynamicTexture(itemIcon, item.getCategory(),
                                item.getQuality(), false, item.getCount())),
                        Scaling.none, Align.CENTER, uidString);
                newItem.setClickListener(equipClickListener(item, newItem));
                offImageList.add(newItem);

            }

        }

    }
    for (int offSlots = offImageList.size(); offSlots < Stardust3d.myFitting.offList.size(); offSlots++) {
        final Inventory item = new Inventory();
        String uidString = "notset";
        item.setCategory("offslot" + offSlots);
        item.setitemUid(-offSlots);
        final Image newItem = new Image(new TextureRegion(
                InventoryIcon.generateDynamicTexture("data/notset.png", "offslot" + offSlots, 1, false, 0)),
                Scaling.none, Align.CENTER, uidString);
        newItem.setClickListener(equipClickListener(item, newItem));
        offImageList.add(newItem);
    }
    for (int augSlots = augImageList.size(); augSlots < Stardust3d.myFitting.augList.size(); augSlots++) {
        final Inventory item = new Inventory();
        String uidString = "notset";
        item.setCategory("augslot" + augSlots);
        item.setitemUid(-augSlots);
        final Image newItem = new Image(new TextureRegion(
                InventoryIcon.generateDynamicTexture("data/notset.png", "augslot" + augSlots, 1, false, 0)),
                Scaling.none, Align.CENTER, uidString);
        newItem.setClickListener(equipClickListener(item, newItem));
        augImageList.add(newItem);
    }

    for (int defSlots = defImageList.size(); defSlots < Stardust3d.myFitting.defList.size(); defSlots++) {
        final Inventory item = new Inventory();
        String uidString = "notset";
        item.setCategory("defslot" + defSlots);
        item.setitemUid(-defSlots);
        final Image newItem = new Image(new TextureRegion(
                InventoryIcon.generateDynamicTexture("data/notset.png", "defslot" + defSlots, 1, false, 0)),
                Scaling.none, Align.CENTER, uidString);
        newItem.setClickListener(equipClickListener(item, newItem));
        defImageList.add(newItem);
    }
    gridEquip.defaults().height(30).width(64).align("topleft");
    gridEquip.add(new Label("Off 1", skin));
    gridEquip.add(new Label("Off 2", skin));
    gridEquip.add(new Label("Off 3", skin));
    gridEquip.add(new Label("Off 4", skin));
    gridEquip.add(new Label("Off 5", skin));
    gridEquip.row();
    gridEquip.defaults().height(64).width(64);
    for (int offSlots = 0; offSlots < offImageList.size(); offSlots++) {
        if (offImageList.get(offSlots) != null) {
            gridEquip.add(offImageList.get(offSlots));
        }
    }
    gridEquip.row();

    gridEquip.defaults().height(30).width(64).align("topleft");
    gridEquip.add(new Label("Def 1", skin));
    gridEquip.add(new Label("Def 2", skin));
    gridEquip.add(new Label("Def 3", skin));
    gridEquip.add(new Label("Def 4", skin));
    gridEquip.add(new Label("Def 5", skin));
    gridEquip.row();
    gridEquip.defaults().height(64).width(64);
    for (int defSlots = 0; defSlots < defImageList.size(); defSlots++) {
        if (defImageList.get(defSlots) != null) {
            gridEquip.add(defImageList.get(defSlots));
        }
    }
    gridEquip.row();

    gridEquip.defaults().height(30).width(64).align("topleft");
    gridEquip.add(new Label("Aug 1", skin));
    gridEquip.add(new Label("Aug 2", skin));
    gridEquip.add(new Label("Aug 3", skin));
    gridEquip.add(new Label("Aug 4", skin));
    gridEquip.add(new Label("Aug 5", skin));
    gridEquip.row();
    gridEquip.defaults().height(64).width(64);
    for (int augSlots = 0; augSlots < augImageList.size(); augSlots++) {
        if (augImageList.get(augSlots) != null) {
            gridEquip.add(augImageList.get(augSlots));
        }

    }
    gridEquip.pack();
    return gridEquip;
}

From source file:com.digitale.screens.StationInventory.java

License:Open Source License

/**
 * @return/*from   w  w  w .j  a v a2 s  . co m*/
 */
private Table initGridCargo() {
    final Table gridCargo = new Table("gridcargo");
    if (Stardust3d.DEBUG)
        gridCargo.debug();
    String itemIcon;
    int itemcounter = 0;
    gridCargo.defaults().height(64).width(64).align("topleft");
    for (int x = 0; x < Stardust3d.myInventory.size(); x++) {

        final Inventory item = Stardust3d.myInventory.get(x);
        itemIcon = "data/" + item.getIcon() + ".png";

        if (Stardust3d.DEBUG) {
            System.out.println("icon " + itemIcon);
        }
        if (item.getSlot_id() == 0) {

            String uidString = "" + item.getInventoryid();
            final Image newItem = new Image(new TextureRegion(InventoryIcon.generateDynamicTexture(itemIcon,
                    item.getCategory(), item.getQuality(), false, item.getCount())), Scaling.none, Align.CENTER,
                    uidString);
            newItem.setClickListener(cargoClickListener(item, newItem));
            gridCargo.add(newItem);
            itemcounter++;
        }
        if (itemcounter % 10 == 9) {
            gridCargo.row();
        }
    }
    gridCargo.pack();
    return gridCargo;
}

From source file:com.digitale.screens.StationInventory.java

License:Open Source License

private Table initGridWarehouse() {
    System.out.println("init warehouse ");
    final Table gridWarehouse = new Table("gridwarehouse");
    if (Stardust3d.DEBUG)
        gridWarehouse.debug();/* www .  j  ava 2 s  .  co m*/
    String itemIcon;

    int itemcounter = 0;
    gridWarehouse.defaults().height(64).width(64).align("topleft");
    for (int x = 0; x < Stardust3d.myInventory.size(); x++) {
        System.out.println("init vendor id " + x);
        final Inventory item = Stardust3d.myInventory.get(x);
        itemIcon = "data/" + item.getIcon() + ".png";

        if (Stardust3d.DEBUG) {
            System.out.println("warehouse icon " + itemIcon);
        }
        if (item.getSlot_id() == 1) {
            if (item.getInventoryid() == Stardust3d.myCharacter.getShipid()) {
                iscurrentship = true;
            } else {
                iscurrentship = false;
            }
            String uidString = "" + item.getInventoryid();
            final Image newItem = new Image(
                    new TextureRegion(InventoryIcon.generateDynamicTexture(itemIcon, item.getCategory(),
                            item.getQuality(), iscurrentship, item.getCount())),
                    Scaling.none, Align.CENTER, uidString);
            newItem.setClickListener(warehouseClickListener(item, newItem));
            gridWarehouse.add(newItem);
            itemcounter++;
        }
        if (itemcounter % 10 == 9) {
            gridWarehouse.row();
        }
    }
    gridWarehouse.pack();
    return gridWarehouse;
}

From source file:com.theinvader360.racegame.MenuScreen.java

License:Apache License

private Table getTable() {
    if (table == null) {
        table = new Table(getSkin());
        table.setFillParent(true);//from   ww  w  .j  av a 2  s  .co  m
        stage.addActor(table);
    }
    return table;
}