Example usage for com.badlogic.gdx.graphics Color GRAY

List of usage examples for com.badlogic.gdx.graphics Color GRAY

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Color GRAY.

Prototype

Color GRAY

To view the source code for com.badlogic.gdx.graphics Color GRAY.

Click Source Link

Usage

From source file:kyle.game.besiege.panels.PanelBattle.java

License:Open Source License

public PanelBattle(SidePanel panel, Battle battle) {
    this.panel = panel;
    this.battle = battle;
    this.addParentPanel(panel);

    LabelStyle lsBig = new LabelStyle();
    lsBig.font = Assets.pixel24;/*from  ww  w  .  ja v  a 2s  .c  o  m*/

    LabelStyle lsFaction = new LabelStyle();
    lsFaction.font = Assets.pixel16neg;

    ls = new LabelStyle();
    ls.font = Assets.pixel16neg;

    lsRetreat = new LabelStyle();
    lsRetreat.font = Assets.pixel13neg;
    lsRetreat.fontColor = Color.YELLOW;

    lsSmall = new LabelStyle();
    lsSmall.font = Assets.pixel13neg;

    lsSmallG = new LabelStyle();
    lsSmallG.font = Assets.pixel13neg;
    lsSmallG.fontColor = Color.GRAY;

    title = new Label("Battle!", lsBig);
    //      Label vsC = new Label("vs", ls);
    Label trpsAC = new Label("Trps:", ls);
    Label trpsDC = new Label("Trps:", ls);
    Label atkAC = new Label("Atk:", ls);
    Label atkDC = new Label("Atk:", ls);
    Label defAC = new Label("Def:", ls);
    Label defDC = new Label("Def:", ls);
    Label advAC = new Label("Adv:", ls);
    Label advDC = new Label("Adv:", ls);

    title.setAlignment(0, 0);
    title.setWrap(true);
    title.setWidth(SidePanel.WIDTH - PAD * 2 - MINI_PAD * 2);
    initA = new Label("", lsFaction);
    initD = new Label("", lsFaction);
    initA.setAlignment(Align.center);
    initD.setAlignment(Align.center);
    initA.setWrap(true);
    initD.setWrap(true);

    if (battle.aArmies.size > 0 && battle.aArmies.first() != null)
        initA.setText(battle.aArmies.first().getName());
    if (battle.dArmies.size > 0 && battle.dArmies.first() != null)
        initD.setText(battle.dArmies.first().getName());

    attackers = new Label("", ls);
    defenders = new Label("", ls);
    trpsA = new Label("", ls);
    trpsD = new Label("", ls);
    trpsA.setWrap(true);
    trpsD.setWrap(true);
    atkA = new Label("", ls);
    atkD = new Label("", ls);
    defA = new Label("", ls);
    defD = new Label("", ls);
    //      advA = new Label("", ls);
    //      advD = new Label("" ,ls);

    balance = new Table();
    red = new Table();
    red.setBackground(new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(redPatch), r, r, r, r)));
    green = new Table();
    green.setBackground(new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(greenPatch), r, r, r, r)));
    //      def = new Label("", ls);
    //      spd = new Label("", ls);

    // Create text
    text = new Table();
    //text.debug();
    text.defaults().padTop(NEG).left();

    text.add(title).colspan(4).fillX().expandX().padBottom(MINI_PAD);
    text.row();
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    //      text.row();
    //      text.add(vsC).colspan(4).center();
    text.row();
    text.add(initA).center().colspan(2).expandX().width((SidePanel.WIDTH - PAD * 2 - MINI_PAD) / 2);
    text.add(initD).center().colspan(2).expandX().width((SidePanel.WIDTH - PAD * 2 - MINI_PAD) / 2);
    text.row();
    text.add(attackers).center().colspan(2);
    text.add(defenders).center().colspan(2);
    text.row();
    text.add(trpsAC).padLeft(MINI_PAD);
    text.add(trpsA).left();
    text.add(trpsDC);
    text.add(trpsD).left();
    text.row();
    text.add(atkAC).padLeft(MINI_PAD);
    text.add(atkA).left();
    text.add(atkDC);
    text.add(atkD).left();
    text.row();
    text.add(defAC).padLeft(MINI_PAD);
    text.add(defA).left();
    text.add(defDC);
    text.add(defD).left();
    text.row();
    //      text.add(advAC).padLeft(MINI_PAD);
    //      text.add(advA).left();
    //      text.add(advDC);
    //      text.add(advD).left();
    text.add(balance).colspan(4).padTop(MINI_PAD);
    text.row();

    Table leftTable = new Table();
    Table rightTable = new Table();
    aTable = new Table();
    dTable = new Table();
    aTable.defaults().left().padTop(NEG).top().left();
    dTable.defaults().right().padTop(NEG).top().right();
    aTable.top();
    dTable.top();
    aRetTable = new Table();
    dRetTable = new Table();
    aRetTable.defaults().left().padTop(NEG).top().left();
    dRetTable.defaults().right().padTop(NEG).top().right();
    leftTable.add(aTable);
    leftTable.row();
    leftTable.add(aRetTable);
    leftTable.top();
    rightTable.add(dTable);
    rightTable.row();
    rightTable.add(dRetTable);
    rightTable.top();

    //aTable.debug();
    //dTable.debug();

    soldierTable = new Table();

    //soldierTable.debug();

    soldierTable.top();
    soldierTable.setBackground(
            new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));
    soldierTable.add().width(SidePanel.WIDTH - 2 * PAD).colspan(2);
    soldierTable.row();
    soldierTable.add(leftTable).top();
    soldierTable.add(rightTable).top();
    text.add().colspan(4).padBottom(PAD);
    text.row();

    soldierPane = new ScrollPane(soldierTable);
    soldierPane.setScrollbarsOnTop(true);
    soldierPane.setFadeScrollBars(false);
    text.add(soldierPane).colspan(4).top().padTop(0).expand().fill();

    text.row();

    // Soldier's stats
    stats = new Table();
    stats.setVisible(false);

    Label levelSC = new Label("Level:", ls);
    Label expSC = new Label("Exp:", ls);
    Label nextSC = new Label("Next:", ls);
    Label atkSC = new Label("Atk:", ls);
    Label defSC = new Label("Def:", ls);
    Label spdSC = new Label("Spd:", ls);
    Label weaponSC = new Label("Weapon: ", ls);
    Label equipmentSC = new Label("Armor: ", ls);

    nameS = new Label("", ls);
    nameS.setAlignment(0, 0);
    levelS = new Label("", ls);
    expS = new Label("", ls);
    nextS = new Label("", ls);
    atkS = new Label("", ls);
    defS = new Label("", ls);
    spdS = new Label("", ls);
    weaponS = new Label("", ls);
    equipmentS = new Label("", ls);

    stats.defaults().left().padTop(NEG);
    stats.add(nameS).colspan(4).width(SidePanel.WIDTH - PAD * 2).fillX().expandX().padBottom(MINI_PAD);
    stats.row();
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.row();
    stats.add(levelSC);
    stats.add(levelS);
    stats.add(atkSC).padLeft(PAD);
    stats.add(atkS);
    stats.row();
    stats.add(expSC);
    stats.add(expS);
    stats.add(defSC).padLeft(PAD);
    stats.add(defS);
    stats.row();
    stats.add(nextSC);
    stats.add(nextS);
    stats.add(spdSC).padLeft(PAD);
    stats.add(spdS);
    stats.row();
    stats.add(weaponSC).colspan(2).padLeft(MINI_PAD).padTop(0);
    stats.add(weaponS).colspan(2).padTop(0);
    stats.row();
    stats.add(equipmentSC).colspan(2).padLeft(MINI_PAD).padTop(0).top();
    stats.add(equipmentS).colspan(2).padTop(0);

    //stats.debug();

    text.add(stats).colspan(4).padTop(PAD);

    this.addTopTable(text);

    this.setButton(1, "Retreat!");
}

From source file:kyle.game.besiege.panels.PanelFaction.java

License:Open Source License

public PanelFaction(SidePanel panel, Faction faction) {
    this.panel = panel;
    this.faction = faction;
    this.addParentPanel(panel);

    LabelStyle lsBig = new LabelStyle();
    lsBig.font = Assets.pixel24;/*w w  w.j  a v a 2  s.  co  m*/

    ls = new LabelStyle();
    ls.font = Assets.pixel16;

    lsG = new LabelStyle();
    lsG.font = Assets.pixel16;
    lsG.fontColor = Color.GRAY;

    lsY = new LabelStyle();
    lsY.font = Assets.pixel16;
    lsY.fontColor = Color.YELLOW;

    Label castlesC = new Label("Castles:", ls);
    Label wealthC = new Label("Wealth:", ls); // maybe give this a mouseover for description.

    title = new Label("", lsBig);
    title.setAlignment(0, 0);
    title.setWrap(true);
    title.setWidth(SidePanel.WIDTH - PAD * 2 - MINI_PAD * 2);
    title.setText(faction.name);

    wealth = new Label("", ls);
    cities = new Table();

    // Create text
    text = new Table();
    //      text.debug();
    text.defaults().padTop(NEG).left();

    //      title.addListener(new InputListener() {
    //         public boolean touchDown(InputEvent event, float x,
    //               float y, int pointer, int button) {
    //            return true;
    //         }
    //         public void touchUp(InputEvent event, float x, float y,
    //               int pointer, int button) {
    //            centerCamera();
    //         }
    //      });

    text.add(title).colspan(2).fillX().expandX().padBottom(MINI_PAD);
    text.row();
    text.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    text.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    text.row();
    text.add(wealthC).padLeft(MINI_PAD).center();
    text.add(wealth).center();
    text.row();
    text.add().colspan(2).padTop(MINI_PAD);
    text.row();

    cities = new Table();
    //      cities.debug();
    //cities.defaults().padTop(NEG);
    cities.top();
    cities.defaults().left().padTop(NEG).expandX();

    castles = new Table();
    //      castles.debug();
    castles.top();
    castles.defaults().left().padTop(NEG).expandX();

    locations = new Table();
    //      locations.debug();
    locations.top();
    locations.defaults().left().top();
    locations.setBackground(
            new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));
    locations.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    locations.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    locations.row();
    locations.add(cities).width((SidePanel.WIDTH - PAD * 2) / 2);
    locations.add(castles).width((SidePanel.WIDTH - PAD * 2) / 2);
    locationPane = new ScrollPane(locations);
    locationPane.setScrollbarsOnTop(true);
    locationPane.setFadeScrollBars(false);

    text.add(locationPane).colspan(2).top().padTop(0);
    text.row();
    text.add().colspan(2).padTop(PAD);
    text.row();

    nobles = new Table();
    //      nobles.debug();
    nobles.top();
    nobles.defaults().padTop(NEG).left();
    noblesPane = new ScrollPane(nobles);
    noblesPane.setScrollbarsOnTop(true);
    noblesPane.setFadeScrollBars(false);
    nobles.setBackground(new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));
    nobles.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    nobles.add().width((SidePanel.WIDTH - PAD * 2) / 2);
    nobles.row();

    text.add(noblesPane).colspan(2);
    text.row();
    text.add().colspan(2).padTop(PAD);
    text.row();

    relations = new Table();
    relations.top();
    relations.defaults().padTop(NEG).left();
    relationsPane = new ScrollPane(relations);
    relationsPane.setScrollbarsOnTop(true);
    relationsPane.setFadeScrollBars(false);
    relations.setBackground(
            new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));

    text.add(relationsPane).colspan(2);
    text.row();

    //      //Soldier's stats
    //      stats = new Table();
    //      stats.setVisible(false);
    //      
    //      Label levelSC = new Label("Level:", ls);
    //      Label expSC = new Label("Exp:",ls);
    //      Label nextSC = new Label("Next:",ls);
    //      Label atkSC = new Label("Atk:", ls);
    //      Label defSC = new Label("Def:", ls);
    //      Label spdSC = new Label("Spd:", ls); 
    //      Label weaponSC = new Label("Weapon: ", ls);
    //      Label equipmentSC = new Label("Armor: ", ls);
    //
    //      nameS = new Label("", ls);
    //      nameS.setAlignment(0,0);
    //      levelS = new Label("", ls);
    //      expS = new Label("", ls);
    //      nextS = new Label("", ls);
    //      atkS = new Label("" ,ls);
    //      defS = new Label("", ls);
    //      spdS = new Label("", ls);
    //      weaponS = new Label("", ls);
    //      equipmentS = new Label("", ls);
    //      
    //      stats.defaults().left().padTop(NEG);
    //      stats.add(nameS).colspan(4).width(SidePanel.WIDTH-PAD*2).fillX().expandX().padBottom(MINI_PAD);
    //      stats.row();
    //      stats.add().colspan(2).width((SidePanel.WIDTH-PAD*2)/2);
    //      stats.add().colspan(2).width((SidePanel.WIDTH-PAD*2)/2);
    //      stats.row();
    //      stats.add(levelSC).padLeft(MINI_PAD);
    //      stats.add(levelS);
    //      stats.add(atkSC).padLeft(PAD);
    //      stats.add(atkS);
    //      stats.row();
    //      stats.add(expSC).padLeft(MINI_PAD);
    //      stats.add(expS);
    //      stats.add(defSC).padLeft(PAD);
    //      stats.add(defS);
    //      stats.row();
    //      stats.add(nextSC).padLeft(MINI_PAD);
    //      stats.add(nextS);
    //      stats.add(spdSC).padLeft(PAD);
    //      stats.add(spdS);
    //      stats.row();
    //      stats.add(weaponSC).colspan(2).padLeft(MINI_PAD).padTop(0);
    //      stats.add(weaponS).colspan(2).padTop(0);
    //      stats.row();
    //      stats.add(equipmentSC).colspan(2).padLeft(MINI_PAD).padTop(0).top();
    //      stats.add(equipmentS).colspan(2).padTop(0);
    //      
    //      //stats.debug();
    //      
    ////      text.add(stats).colspan(4).padTop(PAD);

    this.addTopTable(text);

    this.setButton(4, "Back");
    updateRelations();
}

From source file:kyle.game.besiege.panels.PanelLocation.java

License:Open Source License

public PanelLocation(SidePanel panel, Location location) {
    this.panel = panel;
    this.location = location;
    this.party = location.getParty();
    this.addParentPanel(panel);
    this.playerTouched = false;

    LabelStyle lsBig = new LabelStyle();
    lsBig.font = Assets.pixel22;//from  w w  w  . ja v  a  2 s . co m

    lsMed = new LabelStyle();
    lsMed.font = Assets.pixel18;

    ls = new LabelStyle();
    ls.font = Assets.pixel16;

    lsG = new LabelStyle();
    lsG.font = Assets.pixel16;
    lsG.fontColor = Color.GRAY;

    Label garrisonC = new Label("Garrison:", ls);
    Label populationC = new Label("Pop:", ls);
    Label wealthC = new Label("Wealth:", ls);

    title = new Label(location.getName(), lsBig);
    title.setAlignment(0, 0);
    //      title.setWrap(true); // wrapping messes up click listeners... WTF?
    title.setWidth(SidePanel.WIDTH - PAD * 2 - MINI_PAD * 2);
    title.addListener(new InputListener() {
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
        }

        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            centerCamera();
        }
    });
    faction = new Label("", ls);
    faction.setAlignment(0, 0);
    faction.setText(location.getFactionName());
    type = new Label("", ls);
    type.setAlignment(Align.center); // large city, village, etc
    type.setText(location.getTypeStr());

    garrisonSize = new Label("", ls);
    garrisonSize.setWrap(false);
    population = new Label("", ls);
    wealth = new Label("", ls);

    // Create text
    text = new Table();
    //      text.debug();
    text.defaults().padTop(NEG).left();
    faction.addListener(new InputListener() {
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return true;
        }

        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            setActiveFaction();
        }
    });
    text.add(title).colspan(4).center().padBottom(0);
    text.row();
    text.add().width((SidePanel.WIDTH - PAD * 2) / 4);
    text.add().width((SidePanel.WIDTH - PAD * 2) / 4);
    text.add().width((SidePanel.WIDTH - PAD * 2) / 4);
    text.add().width((SidePanel.WIDTH - PAD * 2) / 4);
    text.row();
    text.add(faction).colspan(4).fillX().expandX();
    text.row();
    text.add(type).colspan(4).fillX().expandX();
    text.row();
    text.add(garrisonC).colspan(2).padLeft(MINI_PAD);
    text.add(garrisonSize).colspan(2).center();
    text.row();
    text.add(populationC).padLeft(MINI_PAD);
    text.add(population).center();
    text.add(wealthC).padLeft(PAD);
    text.add(wealth).center();

    soldierTable = new Table();
    //soldierTable.debug();
    soldierTable.defaults().padTop(NEG);
    soldierTable.top();
    soldierTable.setBackground(
            new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));
    text.row();
    text.add().colspan(4).padBottom(PAD);
    text.row();

    soldierPane = new ScrollPane(soldierTable);
    soldierPane.setScrollbarsOnTop(true);
    soldierPane.setFadeScrollBars(false);
    text.add(soldierPane).colspan(4).top().padTop(0);

    text.row();

    // Soldier's stats
    stats = new Table();
    stats.setVisible(false);

    Label levelSC = new Label("Level:", ls);
    Label expSC = new Label("Exp:", ls);
    Label nextSC = new Label("Next:", ls);
    Label atkSC = new Label("Atk:", ls);
    Label defSC = new Label("Def:", ls);
    Label spdSC = new Label("Spd:", ls);
    Label weaponSC = new Label("Weapon: ", ls);
    Label equipmentSC = new Label("Armor: ", ls);

    nameS = new Label("", ls);
    nameS.setAlignment(0, 0);
    levelS = new Label("", ls);
    expS = new Label("", ls);
    nextS = new Label("", ls);
    atkS = new Label("", ls);
    defS = new Label("", ls);
    spdS = new Label("", ls);
    weaponS = new Label("", ls);
    equipmentS = new Label("", ls);

    stats.defaults().left().padTop(NEG);
    stats.add(nameS).colspan(4).width(SidePanel.WIDTH - PAD * 2).fillX().expandX().padBottom(MINI_PAD);
    stats.row();
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.row();
    stats.add(levelSC).padLeft(MINI_PAD);
    stats.add(levelS);
    stats.add(atkSC).padLeft(PAD);
    stats.add(atkS);
    stats.row();
    stats.add(expSC).padLeft(MINI_PAD);
    stats.add(expS);
    stats.add(defSC).padLeft(PAD);
    stats.add(defS);
    stats.row();
    stats.add(nextSC).padLeft(MINI_PAD);
    stats.add(nextS);
    stats.add(spdSC).padLeft(PAD);
    stats.add(spdS);
    stats.row();
    stats.add(weaponSC).colspan(2).padLeft(MINI_PAD).padTop(0);
    stats.add(weaponS).colspan(2).padTop(0);
    stats.row();
    stats.add(equipmentSC).colspan(2).padLeft(MINI_PAD).padTop(0).top();
    stats.add(equipmentS).colspan(2).padTop(0);

    //stats.debug();

    text.add(stats).colspan(4).padTop(PAD);

    text.padLeft(MINI_PAD);
    this.addTopTable(text);

    playerIn = false;
    //      this.hireMode = false;
    this.panelHire = new PanelHire(panel, location);

    this.setButton(4, "Back");
}

From source file:kyle.game.besiege.panels.PanelParty.java

License:Open Source License

public PanelParty(SidePanel panel, Army army) {
    this.panel = panel;
    this.army = army;
    this.party = army.getParty();
    this.addParentPanel(panel);

    LabelStyle lsBig = new LabelStyle();
    lsBig.font = Assets.pixel24;/*ww  w . j ava2 s.c  o  m*/

    LabelStyle lsFaction = new LabelStyle();
    lsFaction.font = Assets.pixel18;

    ls = new LabelStyle();
    ls.font = Assets.pixel16;

    lsG = new LabelStyle();
    lsG.font = Assets.pixel16;
    lsG.fontColor = Color.GRAY;

    lsY = new LabelStyle();
    lsY.font = Assets.pixel16;
    lsY.fontColor = Color.YELLOW;

    Label sizeC = new Label("Size:", ls);
    Label moraleC = new Label("Morale:", ls);
    Label moneyC = new Label("Money:", ls);
    Label atkC = new Label("Atk:", ls);
    Label defC = new Label("Def:", ls);
    Label spdC = new Label("Spd:", ls);

    title = new Label("", lsBig);
    title.setAlignment(0, 0);
    title.setWrap(true);
    title.setWidth(SidePanel.WIDTH - PAD * 2 - MINI_PAD * 2);
    faction = new Label("", lsFaction);
    faction.setAlignment(0, 0);

    // testing
    title.setText(army.getName());

    faction.setText(army.getFactionName());

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

        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            setActiveFaction();
        }
    });
    action = new Label("", ls);
    action.setWrap(true);
    action.setAlignment(Align.center);
    size = new Label("", ls);
    morale = new Label("", ls);
    money = new Label("", ls);
    atk = new Label("", ls);
    def = new Label("", ls);
    spd = new Label("", ls);

    // Create text
    text = new Table();
    //text.debug();
    text.defaults().padTop(NEG).left();

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

        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            centerCamera();
        }
    });
    text.add(title).colspan(4).fillX().expandX().padBottom(0);
    text.row();
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    text.row();
    text.add(faction).colspan(4).padBottom(MINI_PAD).fillX().expandX();
    text.row();
    text.add(action).colspan(4).padBottom(MINI_PAD).fillX().expandX();
    text.row();
    text.add(sizeC).padLeft(MINI_PAD);
    text.add(size);
    text.add(atkC).padLeft(PAD);
    text.add(atk);
    text.row();
    text.add(moraleC).padLeft(MINI_PAD);
    text.add(morale);
    text.add(defC).padLeft(PAD);
    text.add(def);
    text.row();
    text.add(moneyC).padLeft(MINI_PAD);
    text.add(money);
    text.add(spdC).padLeft(PAD);
    text.add(spd);

    soldierTable = new Table();
    //soldierTable.debug();
    soldierTable.defaults().padTop(NEG);
    soldierTable.top();
    soldierTable.setBackground(
            new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(tablePatch), r, r, r, r)));
    text.row();
    text.add().colspan(4).padBottom(PAD);
    text.row();

    soldierPane = new ScrollPane(soldierTable);
    soldierPane.setScrollbarsOnTop(true);
    soldierPane.setFadeScrollBars(false);
    text.add(soldierPane).colspan(4).top().padTop(0);

    text.row();

    // Soldier's stats
    stats = new Table();
    stats.setVisible(false);

    Label levelSC = new Label("Level:", ls);
    Label expSC = new Label("Exp:", ls);
    Label nextSC = new Label("Next:", ls);
    Label atkSC = new Label("Atk:", ls);
    Label defSC = new Label("Def:", ls);
    Label spdSC = new Label("Spd:", ls);
    Label weaponSC = new Label("Weapon: ", ls);
    Label equipmentSC = new Label("Armor: ", ls);

    nameS = new Label("", ls);
    nameS.setAlignment(0, 0);
    levelS = new Label("", ls);
    expS = new Label("", ls);
    nextS = new Label("", ls);
    atkS = new Label("", ls);
    defS = new Label("", ls);
    spdS = new Label("", ls);
    weaponS = new Label("", ls);
    equipmentS = new Label("", ls);

    stats.defaults().left().padTop(NEG);
    stats.add(nameS).colspan(4).width(SidePanel.WIDTH - PAD * 2).fillX().expandX().padBottom(MINI_PAD);
    stats.row();
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    stats.row();
    stats.add(levelSC).padLeft(MINI_PAD);
    stats.add(levelS);
    stats.add(atkSC).padLeft(PAD);
    stats.add(atkS);
    stats.row();
    stats.add(expSC).padLeft(MINI_PAD);
    stats.add(expS);
    stats.add(defSC).padLeft(PAD);
    stats.add(defS);
    stats.row();
    stats.add(nextSC).padLeft(MINI_PAD);
    stats.add(nextS);
    stats.add(spdSC).padLeft(PAD);
    stats.add(spdS);
    stats.row();
    stats.add(weaponSC).colspan(2).padLeft(MINI_PAD).padTop(0);
    stats.add(weaponS).colspan(2).padTop(0);
    stats.row();
    stats.add(equipmentSC).colspan(2).padLeft(MINI_PAD).padTop(0).top();
    stats.add(equipmentS).colspan(2).padTop(0);

    //stats.debug();

    text.add(stats).colspan(4).padTop(PAD);

    this.addTopTable(text);

    if (this.army == panel.getPlayer()) {
        this.setButton(1, "Upgrades");
        this.setButton(2, "Inventory");
        this.setButton(3, "Character");
    }
    playerTouched = false;

    updateSoldierTable();

    if (!this.party.player)
        this.setButton(4, "Back");
}

From source file:kyle.game.besiege.panels.PanelUnit.java

License:Open Source License

public PanelUnit(SidePanel panel, Unit unit) {
    this.panel = panel;
    this.unit = unit;
    this.battleStage = unit.stage;
    this.battle = this.battleStage.battle;
    this.soldier = unit.soldier;
    this.party = unit.party;
    this.addParentPanel(panel);

    this.max_hp = unit.calcHP();

    LabelStyle lsBig = new LabelStyle();
    lsBig.font = Assets.pixel22;/*ww w.  j  ava 2 s.co m*/
    lsMed = new LabelStyle();
    lsMed.font = Assets.pixel18;
    ls = new LabelStyle();
    ls.font = Assets.pixel16;
    lsG = new LabelStyle();
    lsG.font = Assets.pixel16;
    lsG.fontColor = Color.GRAY;

    Label levelSC = new Label("Level:", ls);
    Label hpSC = new Label("HP:", ls);
    Label expSC = new Label("Height:", ls);
    Label atkSC = new Label("Atk:", ls);
    Label defSC = new Label("Def:", ls);
    Label spdSC = new Label("Spd:", ls);
    Label weaponSC = new Label("Weapon: ", ls);
    Label equipmentSC = new Label("Armor: ", ls);

    title = new Label(soldier.getName(), lsBig);
    title.setAlignment(0, 0);
    //      title.setWrap(true); // wrapping messes up click listeners... WTF?
    title.setWidth(SidePanel.WIDTH - PAD * 2 - MINI_PAD * 2);
    //      title.addListener(new InputListener() {
    //         public boolean touchDown(InputEvent event, float x,
    //               float y, int pointer, int button) {
    //            return true;
    //         }
    //         public void touchUp(InputEvent event, float x, float y,
    //               int pointer, int button) {
    //            centerCamera();
    //         }
    //      });

    armyName = new Label("", ls);
    if (party.army != null)
        armyName.setText(party.army.getName());
    armyName.setAlignment(0, 0);

    levelS = new Label("" + soldier.level, ls);
    hpS = new Label("" + unit.hp, ls);
    expS = new Label("" + soldier.next, ls);
    atkS = new Label("" + soldier.getAtk(), ls);
    defS = new Label("" + soldier.getDef(), ls);
    spdS = new Label("" + soldier.getSpd(), ls);
    weaponS = new Label("" + soldier.weapon.name, ls);
    if (unit.isRanged())
        weaponS.setText(soldier.rangedWeapon.name + "(" + unit.quiver + ")");
    weaponS.setAlignment(0, 0);

    equipmentS = new Label("", ls);
    actionS = new Label("" + unit.getStatus(), ls);
    actionS.setAlignment(0, 0);

    health = new Table();
    red = new Table();
    red.setBackground(new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(redPatch), r, r, r, r)));
    green = new Table();
    green.setBackground(new NinePatchDrawable(new NinePatch(Assets.atlas.findRegion(greenPatch), r, r, r, r)));

    // Create text
    text = new Table();
    //text.debug();
    text.defaults().padTop(NEG).left();

    //      title.addListener(new InputListener() {
    //         public boolean touchDown(InputEvent event, float x,
    //               float y, int pointer, int button) {
    //            return true;
    //         }
    //         public void touchUp(InputEvent event, float x, float y,
    //               int pointer, int button) {
    //            centerCamera();
    //         }
    //      });
    text.add(title).colspan(4).fillX().expandX().padBottom(0);
    text.row();
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    text.add().colspan(2).width((SidePanel.WIDTH - PAD * 2) / 2);
    text.row();
    text.add(armyName).colspan(4).fillX().expandX();
    text.row();
    text.add(health).colspan(4).padTop(MINI_PAD).padBottom(MINI_PAD);
    text.row();
    text.add(actionS).colspan(4).fillX().expandX();
    text.row();
    text.add(weaponS).colspan(4).fillX().expandX();
    text.row();
    text.add(atkSC).padLeft(MINI_PAD);
    text.add(atkS);
    text.add(levelSC).padLeft(PAD);
    text.add(levelS);
    text.row();
    text.add(defSC).padLeft(MINI_PAD);
    text.add(defS);
    text.add(hpSC).padLeft(PAD);
    text.add(hpS);
    text.row();
    text.add(spdSC).padLeft(MINI_PAD);
    text.add(spdS);
    text.add(expSC).padLeft(PAD);
    text.add(expS);

    text.row();

    text.padLeft(MINI_PAD);
    this.addTopTable(text);
}

From source file:ldtk.demo1.WorldRenderer.java

public void setup() {
    // Load the textures (CC0 licensed textures from http://opengameart.org) and make sure that they wrap.
    backgroundTexture = Kernel.images.get("textures/stones").region().getTexture();
    backgroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
    midgroundTexture = Kernel.images.get("textures/building").region().getTexture();
    midgroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
    foregroundTexture = Kernel.images.get("textures/grass").region().getTexture();
    foregroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

    // Create the landscape renderers.
    Landscape[] landscapes = world.landscapes();
    landscapeRenderers = new LandscapeRenderer[landscapes.length];
    landscapeRenderers[World.BACKGROUND_LAYER] = new LandscapeRenderer(landscapes[World.BACKGROUND_LAYER],
            backgroundTexture, Color.DARK_GRAY);
    landscapeRenderers[World.MIDGROUND_LAYER] = new LandscapeRenderer(landscapes[World.MIDGROUND_LAYER],
            midgroundTexture, Color.GRAY);
    landscapeRenderers[World.FOREGROUND_LAYER] = new LandscapeRenderer(landscapes[World.FOREGROUND_LAYER],
            foregroundTexture, Color.WHITE);
}

From source file:maze.maker.Cell.java

public void draw() {
    if (bVisited) {
        shape.begin(ShapeRenderer.ShapeType.Filled);
        shape.setColor(Color.GRAY);
        shape.rect(fDx, fDy, scl, scl);/* w  w w.  jav a 2 s  . c  o m*/
        shape.end();
    }
    if (bMazeFinished) {
        if (bStart) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.BLUE);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        } else if (bTarget) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.RED);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        } else if (bHighlight) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.WHITE);
            shape.rect(fDx, fDy, scl, scl);
            //                shape.triangle(fDx, fDy, fDx, fDy + scl, fDx + scl, fDy + scl / 2);
            //                shape.circle(fDx + scl/2, fDy + scl/2, scl/2);
            shape.end();
        } else if (bChecked) {
            shape.begin(ShapeRenderer.ShapeType.Filled);
            shape.setColor(Color.BROWN);
            shape.rect(fDx, fDy, scl, scl);
            shape.end();
        }
    }
    shape.begin(ShapeRenderer.ShapeType.Line);
    shape.setColor(Color.BLACK);
    if (Sides[0]) {// top
        shape.rectLine(fDx, fDy + scl - fWidth, fDx + scl, fDy + scl + fWidth, fWidth * 2);
    }
    if (Sides[1]) {// bottom
        shape.rectLine(fDx, fDy - fWidth, fDx + scl, fDy + fWidth, fWidth * 2);
        //            shape.line(0, 0, w, h);
    }
    if (Sides[2]) {// left
        shape.rectLine(fDx - fWidth, fDy, fDx + fWidth, fDy + scl, fWidth * 2);
    }
    if (Sides[3]) {// right
        shape.rectLine(fDx + scl - fWidth, fDy, fDx + scl + fWidth, fDy + scl, fWidth * 2);
    }
    shape.end();
}

From source file:mobi.shad.s3lib.gui.widget.HtmlView.java

License:Apache License

/**
 * @param node//from  w  w w  .  j  a v a 2  s .  co  m
 * @return
 */
private CssStyle parseCssStyle(final Element node) {
    final CssStyle style = new CssStyle();

    //
    // Color
    //
    String color = node.getAttribute("color", "");
    if (color.equalsIgnoreCase("yellow")) {
        style.color = Color.YELLOW;
    } else if (color.equalsIgnoreCase("red")) {
        style.color = Color.RED;
    } else if (color.equalsIgnoreCase("green")) {
        style.color = Color.GREEN;
    } else if (color.equalsIgnoreCase("cyan")) {
        style.color = Color.CYAN;
    } else if (color.equalsIgnoreCase("blue")) {
        style.color = Color.BLUE;
    } else if (color.equalsIgnoreCase("gray")) {
        style.color = Color.GRAY;
    } else if (color.equalsIgnoreCase("light_gray")) {
        style.color = Color.LIGHT_GRAY;
    } else if (color.equalsIgnoreCase("dark_gray")) {
        style.color = Color.DARK_GRAY;
    } else if (color.equalsIgnoreCase("orange")) {
        style.color = Color.ORANGE;
    } else if (color.equalsIgnoreCase("magenta")) {
        style.color = Color.MAGENTA;
    } else if (color.equalsIgnoreCase("pink")) {
        style.color = Color.PINK;
    }

    //
    // Align
    //
    String align = node.getAttribute("align", "");
    if (align.equalsIgnoreCase("right")) {
        style.align = Align.right;
    } else if (align.equalsIgnoreCase("left")) {
        style.align = Align.left;
    } else if (align.equalsIgnoreCase("center")) {
        style.align = Align.center;
    } else {
        style.align = Align.left;
    }

    //
    // Font
    //
    String font = node.getAttribute("font", "");
    //      if (font.equalsIgnoreCase("sans12")){
    //         style.font="sans12";
    //      } else if (font.equalsIgnoreCase("sans13")){
    //         style.font="sans13";
    //      } else if (font.equalsIgnoreCase("sans14")){
    //         style.font="sans14";
    //      } else if (font.equalsIgnoreCase("sans15")){
    //         style.font="sans15";
    //      } else if (font.equalsIgnoreCase("droid14")){
    //         style.font="droid14";
    //      } else if (font.equalsIgnoreCase("droid15")){
    //         style.font="droid15";
    //      } else if (font.equalsIgnoreCase("droid16")){
    //         style.font="droid16";
    //      } else if (font.equalsIgnoreCase("droid17")){
    //         style.font="droid17";
    //      } else if (font.equalsIgnoreCase("droid18")){
    //         style.font="droid18";
    //      } else if (font.equalsIgnoreCase("droid22")){
    //         style.font="droid22";
    //      } else if (font.equalsIgnoreCase("droid24")){
    //         style.font="droid24";
    //      }

    //
    // CollSpan
    //
    int collSpan = node.getIntAttribute("collspan", 1);
    if (collSpan > 1) {
        style.collSpan = collSpan;
    }

    return style;
}

From source file:net.bplaced.therefactory.voraciousviper.screens.TitleScreen.java

License:Open Source License

@Override
public void render(float delta) {
    super.render(delta);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    update(delta);/*from   w  ww. j  a  va2  s .c o m*/

    // draw gradient background
    shapeRenderer.setProjectionMatrix(camera.combined);
    shapeRenderer.begin(ShapeType.Filled);
    shapeRenderer.rect(0, 0, viewport.getWorldWidth(), viewport.getWorldHeight(), Color.BLACK, Color.BLACK,
            colorScaler, colorScaler);
    shapeRenderer.end();

    stage.getBatch().setProjectionMatrix(camera.combined);
    stage.getBatch().begin();

    if (state.equals(TitleScreenState.ShowSettings)) { // button descriptions
        font.setColor(Color.WHITE);
        font.draw(stage.getBatch(),
                VoraciousViper.getInstance().getBundle().get(I18NKeys.ControlsBy) + " "
                        + VoraciousViper.getInstance().getBundle().get(prefs.getString(PrefsKeys.Controls)),
                buttonsSettings[0][0].getX(), 25);
    } else if (state.equals(TitleScreenState.ShowAbout)) { // about text
        font.setColor(1, 1, 1, 1 - xOffset / xOffsetMax);
        float xOffsetAboutText = paddingFromViewport + xOffset + (xOffset / xOffsetMax) * 50;
        font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().format(I18NKeys.AboutText,
                VoraciousViper.getInstance().getVersionName()), xOffsetAboutText, 180);

        spriteThere.setAlpha(1 - xOffset / xOffsetMax);
        spriteThere.setScale(.4f);
        spriteThere.setPosition(xOffsetAboutText + 81, 105);
        spriteThere.draw(stage.getBatch());

        spriteFactory.setAlpha(1 - xOffset / xOffsetMax);
        spriteFactory.setScale(.4f);
        spriteFactory.setPosition(xOffsetAboutText + 125, spriteThere.getY());
        spriteFactory.draw(stage.getBatch());
    }

    if (!state.equals(TitleScreenState.ShowScoreTable)) {
        font.setColor(Color.GRAY);
        if (state.equals(TitleScreenState.ShowMainMenu)) {
            font.draw(stage.getBatch(), VoraciousViper.getInstance().getBundle().get(I18NKeys.CopyrightText),
                    150, 40);
        }
        font.setColor(Color.LIGHT_GRAY);
        font.draw(stage.getBatch(),
                VoraciousViper.getInstance().getBundle().get(I18NKeys.Version) + " "
                        + VoraciousViper.getInstance().getVersionName(),
                spriteTitle.getX() + spriteTitle.getWidth() - 98, spriteTitle.getY() + 5);
    }

    if (Config.SHOW_BADGE) {
        spriteThere.setScale(.5f, .5f);
        spriteThere.setPosition(335, 105);
        spriteThere.draw(stage.getBatch());

        spriteFactory.setScale(.5f, .5f);
        spriteFactory.setPosition(spriteThere.getX() + 65, spriteThere.getY());
        spriteFactory.draw(stage.getBatch());

        spriteBadge.setScale(.5f, .5f);
        spriteBadge.setPosition(-100, 40);
        spriteBadge.draw(stage.getBatch());
    } else {
        stage.getBatch().end();
        stage.draw();
        stage.getBatch().begin();
        if (state.equals(TitleScreenState.ShowMainMenu)) {
            renderMainMenuButtons(); // draw image captions on main menu buttons
        } else if (state.equals(TitleScreenState.ShowScoreTable)) {
            renderScoreTable();
        } else if (state.equals(TitleScreenState.ShowAbout)) {
            stage.getBatch().draw(spriteDownload, buttonSoudtrack.getX() + buttonSoudtrack.getWidth() - 20,
                    buttonSoudtrack.getY() + buttonSoudtrack.getHeight() - 20, 0, 0,
                    spriteDownload.getWidth() / 2f, spriteDownload.getHeight() / 2f,
                    Utils.oscilliate(elapsedTime, scaleMin, scaleMax, period),
                    Utils.oscilliate(elapsedTime, scaleMin, scaleMax, -period),
                    Utils.oscilliate(elapsedTime, -rotate, rotate, period));
            stage.getBatch().draw(spriteStar, buttonRate.getX() + buttonRate.getWidth() - 20,
                    buttonRate.getY() + buttonRate.getHeight() - 20, 0, 0, spriteStar.getWidth() / 2f,
                    spriteStar.getHeight() / 2f, Utils.oscilliate(elapsedTime, scaleMin, scaleMax, period),
                    Utils.oscilliate(elapsedTime, scaleMin, scaleMax, -period),
                    Utils.oscilliate(elapsedTime, -rotate, rotate, period));
        }
    }

    spriteTitle.draw(stage.getBatch());
    spritesViperHeads[indexCurrentHeadSprite].draw(stage.getBatch()); // dot on the 'i' of Vorac_i_ous in the title image

    if (updating) {
        VoraciousViper.getInstance().getFadeSprite().setBounds(0, 0, viewport.getWorldWidth(),
                viewport.getWorldHeight());
        VoraciousViper.getInstance().getFadeSprite().setAlpha(.8f);
        VoraciousViper.getInstance().getFadeSprite().draw(stage.getBatch());
        font.setColor(Color.WHITE);
        String updating = VoraciousViper.getInstance().getBundle().get(I18NKeys.Updating) + "...";
        font.draw(stage.getBatch(), updating,
                viewport.getWorldWidth() / 2 - Utils.getFontWidth(updating, font) / 2,
                viewport.getWorldHeight() / 2 - Utils.getFontHeight(updating, font) / 2);
    }

    stage.getBatch().end();
}

From source file:net.bplaced.therefactory.voraciousviper.ui.Hud.java

License:Open Source License

public void render(SpriteBatch batch) {
    if (!gameScreen.getLevel().hadFirstLevelTransition()) {
        return;//  www  .j a va 2 s.com
    }
    spriteTitle.draw(batch);

    // change color of title if viper has collected the key
    if (gameScreen.getViper().hasKey()) {
        spriteKey.draw(batch);
    }

    // render number of lives
    for (int i = 0; i < level.getViper().getNumLives(); i++) {
        batch.draw(level.getViper().getHeadX2(), livesXOffset + i * level.getViper().getHeadX2().getWidth(),
                Config.WINDOW_HEIGHT - level.getViper().getHeadX2().getHeight());
    }

    font.setColor(Color.GRAY);

    int scoreX = 230;
    font.draw(batch, VoraciousViper.getInstance().getBundle().get(I18NKeys.Level), scoreX + 25, hudPositionY);
    font.draw(batch, VoraciousViper.getInstance().getBundle().get(I18NKeys.Score), scoreX + 140, hudPositionY);
    font.draw(batch, VoraciousViper.getInstance().getBundle().get(I18NKeys.Steps), scoreX + 260, hudPositionY);

    font.setColor(Color.YELLOW);
    font.draw(batch, stringBuilder.append(Utils.padLeft(level.getViper().getNumSteps(), 4)), scoreX + 215,
            hudPositionY);
    stringBuilder.setLength(0);

    font.draw(batch, stringBuilder.append(Utils.padLeft(level.getViper().getScore(), 4)), scoreX + 95,
            hudPositionY);
    stringBuilder.setLength(0);

    font.draw(batch, stringBuilder.append(Utils.padLeft(level.getIndexCurrentLevel() + 1, 2)), scoreX,
            hudPositionY);
    stringBuilder.setLength(0);
}