List of usage examples for com.badlogic.gdx.graphics Color GRAY
Color GRAY
To view the source code for com.badlogic.gdx.graphics Color GRAY.
Click Source Link
From source file:com.talas777.ZombieLord.Menu.java
License:Open Source License
private void drawParty(SpriteBatch batch, int full, boolean pushBack) { int ms = 106; int m = 213;/*from www . j av a 2s . co m*/ int p = 50; if (full == 0) p -= 20; if (pushBack) p -= 25; PartyMember[] members = party.getActiveMembers(); for (int i = 0; i < members.length && i < 3; i++) { // if for some reason we have 4 members, we still only care about 3.. if (full == 1) { ninePatch.draw(batch, p - 20, m - ms * i, 260, 105); } else if (full == 2) { ninePatch.draw(batch, p - 20, m - ms * i, 475, 105); } else { ninePatch.draw(batch, p - 5, m - ms * i, 170, 105); } // draw the members ugly mug shot if (full != 0) { Texture t = members[i].getFace(); Sprite s = new Sprite(t); s.scale(-0.29f); s.setPosition(p - 30, m - ms * i - 11); s.draw(batch); } font.setColor(Color.WHITE); int cur = members[i].getHealth(); int max = members[i].getHealthMax(); if (cur < max / 2f) { font.setColor(Color.YELLOW); if (members[i].getHealth() == 0) font.setColor(Color.GRAY); } font.draw(batch, members[i].getName(), p, m - ms * i + 20); int base = 80; if (full == 0) base = 5; font.draw(batch, "LVL: " + members[i].getLevel(), base + p, m - ms * i + 100); String xpString = "error"; Color old = font.getColor(); if (members[i].getLevel() == ZombieLord.MAX_PLAYER_LEVEL) { xpString = " --- "; font.setColor(Color.BLACK); } else xpString = members[i].getExperience() + "/" + PartyMember.getExperienceForLevel(members[i].getLevel() + 1); font.draw(batch, "XP: " + xpString, base + p, m - ms * i + 85); font.setColor(old); font.draw(batch, "HP: " + cur + "/" + max, base + p, m - ms * i + 70); font.draw(batch, "MP: " + members[i].getMana() + "/" + members[i].getManaMax(), base + p, m - ms * i + 55); if (full == 2) { // draw all data font.draw(batch, "STR: " + members[i].getStrength(), 240 + p, m - ms * i + 100); font.draw(batch, "VIT: " + members[i].getVitality(), 350 + p, m - ms * i + 100); //font.draw(batch, "VIT: "+members[i].getVitality(), 240+p, m-ms*i+85); //font.draw(batch, "AGI: "+members[i].getAgility(), 240+p, m-ms*i+70); font.draw(batch, "INT: " + members[i].getIntelligence(), 240 + p, m - ms * i + 85); //font.draw(batch, "INT: "+members[i].getIntelligence(), 240+p, m-ms*i+55); font.draw(batch, "WIS: " + members[i].getWisdom(), 350 + p, m - ms * i + 85); font.draw(batch, "SPR: " + members[i].getSpirit(), 240 + p, m - ms * i + 70); font.draw(batch, "AGI: " + members[i].getAgility(), 350 + p, m - ms * i + 70); font.draw(batch, "LUCK: " + members[i].getLuck(), 240 + p, m - ms * i + 55); } } }
From source file:com.talas777.ZombieLord.ZombieLord.java
License:Open Source License
public void drawCombatUISprites(SpriteBatch batch) { //LinkedList<Sprite> list = new LinkedList<Sprite>(); //first make sprites for leoric.. hes always there and always nr.1 (atleast for now) PartyMember[] activeMembers = this.party.getActiveMembers(); int num = 0;//from www. j av a 2s . co m int fontOffset = 14; for (PartyMember m : activeMembers) { // draw characters name int healthPercent = (int) Math.min(100, Math.max(0, Math.ceil(((m.getHealth() + 0.0f) / m.getHealthMax()) * 100))); Color fontColor = Color.WHITE; if (m.getHealth() == 0) fontColor = Color.GRAY; else if (healthPercent <= 10) fontColor = Color.YELLOW; font.setColor(fontColor); smallFont.setColor(fontColor); font.draw(batch, m.getName(), 10, 67 - 32 * num + fontOffset); // draw the red inside the hp bar if (m.getHealth() > 0) barHp.draw(batch, 102 + 4, 67 - 32 * num + 1, healthPercent, 17); //Sprite myHp = new Sprite(hpTex,0,0+19*healthPerdeca,106,19); Sprite myHp = new Sprite(hpTex, 0, 0, 106, 19); myHp.setX(102); myHp.setY(67 - 32 * num); myHp.draw(batch); String healthstr = m.getHealth() + "/" + m.getHealthMax(); smallFont.draw(batch, healthstr, 102 + 60 - (healthstr.length() / 2) * 13, 67 - 32 * num + fontOffset + 2); int manaPercent = (int) Math.min(100, Math.max(0, Math.ceil(((m.getMana() + 0.0f) / m.getManaMax()) * 100))); if (m.getMana() > 0) barMp.draw(batch, 230 + 4, 67 - 32 * num + 1, manaPercent, 17); Sprite myMp = new Sprite(mpTex, 0, 0, 106, 19); myMp.setX(230); myMp.setY(67 - 32 * num); myMp.draw(batch); String manastr = m.getMana() + "/" + m.getManaMax(); smallFont.draw(batch, manastr, 230 + 60 - (manastr.length() / 2) * 13, 67 - 32 * num + fontOffset + 2); int timePercent = (int) Math.min(100, Math.max(0, Math.round(((m.actionTimer + 0.0f) / 100f) * 100))); if (m.getHealth() > 0) barTime.draw(batch, 358 + 4, 67 - 32 * num + 1, 100 - timePercent, 17); Sprite myTime = new Sprite(tmTex, 0, 19 * 10, 106, 19); myTime.setX(358); myTime.setY(67 - 32 * num); myTime.draw(batch); num++; } font.setColor(Color.WHITE); smallFont.setColor(Color.WHITE); }
From source file:com.talas777.ZombieLord.ZombieLord.java
License:Open Source License
@Override public void render() { if (this.menu != null) { if (this.menu.isDead()) { // menu is scheduled for deletion, so carry it out this.menu.dispose(); this.menu = null; this.gameMode = MODE_MOVE; }/*from w w w . j a v a2 s. c o m*/ } if (musicVolume < 1f) { musicVolume += Gdx.graphics.getDeltaTime() / 10f; if (musicVolume > 1f) { musicVolume = 1f; System.out.println("Done fading.."); } fadingMusic.setVolume(musicVolume * this.globalMusicVolume); } if (musicPause > 0) { musicPause -= Gdx.graphics.getDeltaTime(); if (musicPause <= 0) { musicPause = 0; // resume music if (this.combatMusic != null) this.combatMusic.play(); else if (this.currentMusic != null) this.currentMusic.play(); } else { // pause music or keep it paused if (this.combatMusic != null) this.combatMusic.pause(); if (this.currentMusic != null) this.currentMusic.pause(); } } if (this.fallingTexture != null) { if (this.falling == null) { this.falling = new Array<Sprite>(); } //System.out.println("rain: "+this.falling.size); // pour de rain (Count de money) //for(int i = 0; i < this.fallingDensity; i++){ if (this.falling.size < this.fallingDensity) { Sprite newDrop = new Sprite(fallingTexture, 0, 0, 8, 8); newDrop.setY(posy + h); newDrop.setX(posx - 20 - w / 2 + (float) Math.random() * (w + 20)); this.falling.add(newDrop); this.drawSprites.add(newDrop); } Iterator<Sprite> iter = falling.iterator(); while (iter.hasNext()) { Sprite s = iter.next(); s.setY(s.getY() - this.fallSpeed * Gdx.graphics.getDeltaTime()); if (posy + h / 2 - s.getY() > this.minFallDist) { // OK to delete? if (posy + h / 2 - s.getY() >= this.maxFallDist) { this.drawSprites.remove(s); iter.remove(); } else if (Math.random() * 100 > 90) { addAnimation(new Sprite(new Texture(Gdx.files.internal("data/rain_splash.png"))), (int) s.getX(), (int) s.getY(), 3); this.drawSprites.remove(s); iter.remove(); } } } } else if (this.falling != null) { // Clean up rain.. Iterator<Sprite> iter = falling.iterator(); while (iter.hasNext()) { Sprite s = iter.next(); this.drawSprites.remove(s); iter.remove(); } this.falling = null; } if (gameMode == MODE_DIALOG) { // a Dialog is active or using the menus? if (this.currentDialog == null) { // menu // TODO: ??? } else { // dialog if (this.dialogWait > 0) { this.dialogTicker += Gdx.graphics.getDeltaTime() * 20; if (Gdx.input.isButtonPressed(Keys.ENTER))// Speed up the dialog a bit dialogWait = 0; else dialogWait -= Gdx.graphics.getDeltaTime(); } else if (this.currentDialog.hasNextUtterance()) { //TODO: this has to be done more nicely somehow.. Utterance u = this.currentDialog.getNextUtterance(); System.out.print(u.speaker + ": "); //System.out.println(u.sentence); this.curSpeaker = u.speaker; this.curSentence = u.getSentence(); this.dialogTicker = 1; //for(int i = 0; i < this.curSentence.length; i++) // System.out.println("_"+this.curSentence[i]+"_"); dialogWait = (u.length * 0.07f); // TODO: hum hum if (dialogWait < 1.7f) dialogWait = 1.7f; } else { // apply secondary effects and change gameMode back to whatever normal is // TODO: would be nice if dialogs could be had inside combat also.. // but not strictly required. this.curSpeaker = null; this.curSentence = null; if (this.currentDialog.questHint != null) { this.questHint = this.currentDialog.questHint; } if (this.currentDialog.getTimeChange() != null) { this.timeTracker.setTime(this.currentDialog.getTimeChange()); } ZombieDefense zd = this.currentDialog.getZombieDefense(); if (zd != null) { // Start zombie defense by going to the correct game mode.. this.gameMode = MODE_ZOMBIE_DEFENSE; this.loadZombieDefense(zd); // Zombie Defense has highest priority. this.currentDialog = null; return; } MonsterSetup setup = this.currentDialog.getFight(); for (PartyMember joiner : this.currentDialog.getMemberJoins()) { this.party.addMember(joiner); } if (this.currentDialog.nextLevel != null) { // Level change.. if (setup != null) { // after fight.. this.returnLevel = this.currentDialog.nextLevel; this.posx = this.currentDialog.posx; this.posy = this.currentDialog.posy; this.lastDirection = this.currentDialog.direction; } } if (setup != null) { // fight! this.loadCombat(setup); } else if (this.currentDialog.nextLevel != null) { // change level this.loadLevel(this.currentDialog.nextLevel, this.currentDialog.posx, this.currentDialog.posy, this.currentDialog.direction); } else { // No combat, no Level change.. // Guess we just have to go back to normal then :< this.gameMode = MODE_MOVE; return; } this.currentDialog = null; } } } boolean left = false; boolean right = false; boolean up = false; boolean down = false; if (gameMode == MODE_MOVE) { if (returnLevel instanceof MyHouse) { if (moverTimer > 0) { // load princess this.moverTimer -= Gdx.graphics.getDeltaTime(); if (moverTimer <= 0) { this.mover.setTexture(new Texture(Gdx.files.internal("data/princess.png"))); mover.setRegion(0, 64 * 2, 64, 64); } } else if (this.timeTracker.hasOccured("talk with gf")) { // unload princess this.mover.getTexture().dispose(); this.drawSprites.remove(mover); } } if (returnLevel instanceof Church) { if (this.timeTracker.hasOccured(("zero"))) { // unload dead priest this.mover.getTexture().dispose(); this.drawSprites.remove(mover); } } if (Gdx.input.isKeyPressed(Keys.UP)) { //System.out.println("damop:"+jumper.getLinearDamping()); jumper.applyLinearImpulse(new Vector2(0.0f, moveSpeed), jumper.getWorldCenter()); posy += (100 * Gdx.graphics.getDeltaTime()); up = true; } if (Gdx.input.isKeyPressed(Keys.DOWN)) { jumper.applyLinearImpulse(new Vector2(0.0f, -moveSpeed), jumper.getWorldCenter()); posy -= (100 * Gdx.graphics.getDeltaTime()); down = true; } if (Gdx.input.isKeyPressed(Keys.LEFT) && !up && !down) { jumper.applyLinearImpulse(new Vector2(-moveSpeed, 0.0f), jumper.getWorldCenter()); posx -= (100 * Gdx.graphics.getDeltaTime()); left = true; } if (Gdx.input.isKeyPressed(Keys.RIGHT) && !up && !down) { jumper.applyLinearImpulse(new Vector2(moveSpeed, 0.0f), jumper.getWorldCenter()); posx += (100 * Gdx.graphics.getDeltaTime()); right = true; } } if (Gdx.input.isKeyPressed(Keys.ESCAPE)) //TODO: confirm dialog Gdx.app.exit(); //camera.lookAt(princess.getX(), princess.getY(), 0); //background.scroll(posx, posy); //background. /*background.setX(posx); background.setY(posy); collisionLayer.setX(posx); collisionLayer.setY(posy); */ if (gameMode == MODE_MOVE) { world.step(Gdx.app.getGraphics().getDeltaTime(), 3, 3); posx = jumper.getPosition().x * PIXELS_PER_METER; posy = jumper.getPosition().y * PIXELS_PER_METER; leoricSprite.setX(posx - 32); leoricSprite.setY(posy - 10); pointer.setTransform(jumper.getPosition().x, jumper.getPosition().y, 0); camera.position.x = leoricSprite.getX() + 32; camera.position.y = leoricSprite.getY() + 16; if ((left || right || up || down) && this.levelLoadGraceTime <= 0) { // Only attract monsters and dialogs when moving if (this.activeDialogs != null && this.activeDialogs.size() > 0) { for (Dialog d : activeDialogs) { if (d.isInside((int) posx, (int) posy, timeTracker)) { boolean activate = false; // button? if (d.button != 0) { activate = Gdx.input.isKeyPressed(d.button); } else activate = true; if (activate) { // Start the dialog this.gameMode = MODE_DIALOG; this.currentDialog = d; return; } } } } if (this.activeMonsterAreas != null && this.activeMonsterAreas.size() > 0) { if (this.nextCombat > 0) { // Try to limit how often you have to fight somewhat.. nextCombat -= Gdx.graphics.getDeltaTime(); } else { for (MonsterArea area : activeMonsterAreas) { // check if player is inside it if (area.isInside((int) posx, (int) posy)) { // roll a dice to find out if the player should be attacked. float num = (float) Math.random(); //if(Math.random()*100>90) //System.out.println(num+" v.s. "+area.encounterChance); if (num < area.encounterChance) { // we have a winner.. nextCombat = 10f; // aprox 10 seconds to next fight? this.loadCombat(area); return; // TODO: not sure if this is a good idea or bad // either return or break.. } } } } } } else if (this.levelLoadGraceTime > 0) { this.levelLoadGraceTime -= Gdx.graphics.getDeltaTime(); } if (Gdx.input.isKeyPressed(Keys.B)) { System.out.println("position: x=" + posx + ", y=" + posy + ", time=" + timeTracker.getTime() + ", cam:[" + camera.position.x + "," + camera.position.y + "]."); } if (Gdx.input.isKeyPressed(Keys.D)) { this.debug = !this.debug; System.out.println("debug :" + (this.debug ? "On" : "Off")); if (debug) this.moveSpeed += 0.02f; else this.moveSpeed -= 0.02f; } // Keep the camera inside the level.. Maybe too aggressive? if (camera.position.y <= h / 2 + this.camMinY) camera.position.y = h / 2 + 1 + this.camMinY; else if (camera.position.y >= this.camMaxY - h / 2) camera.position.y = this.camMaxY - h / 2 - 1; if (camera.position.x <= w / 2 + this.camMinX) camera.position.x = w / 2 + 1 + this.camMinX; else if (camera.position.x >= this.camMaxX - w / 2) camera.position.x = this.camMaxX - w / 2 - 1; camera.update(); if (stillTime > 0) stillTime -= Gdx.graphics.getDeltaTime(); int frame = (int) Math.ceil(currentWalkFrame) + 0; if (up == true) { lastDirection = 0; leoricSprite.setRegion(64 * frame, 0, 64, 64); //princess = new Sprite(texture2, 0, 64*2, 64, 0); } else if (down == true) { lastDirection = 1; leoricSprite.setRegion(64 * frame, 64 * 2, 64, 64); //princess = new Sprite(texture2, 0, 64*2, 64, 64); } else if (left == true) { lastDirection = 3; leoricSprite.setRegion(64 * frame, 64 * 1, 64, 64); //princess = new Sprite(texture2, 0, 64*2, 64, 128); } else if (right == true) { leoricSprite.setRegion(64 * frame, 64 * 3, 64, 64); lastDirection = 2; //princess = new Sprite(texture2, 0, 64*2, 64, 128+64); } if (left || right) { currentWalkFrame = (float) (currentWalkFrame >= 7 - 0.20 ? 0 : currentWalkFrame + 0.10); stillTime = 0.1f; } else if (up || down || left || right) { currentWalkFrame = (float) (currentWalkFrame >= 8 - 0.10 ? 1 : currentWalkFrame + 0.10); stillTime = 0.1f; } else if (stillTime <= 0) { // stop the animation. currentWalkFrame = 0; switch (lastDirection) { case 0: //north leoricSprite.setRegion(0, 0, 64, 64); break; case 2: //east leoricSprite.setRegion(0, 64 * 3, 64, 64); break; case 3: //west leoricSprite.setRegion(0, 64 * 1, 64, 64); break; default: //south leoricSprite.setRegion(0, 64 * 2, 64, 64); break; } } } boolean waiting = false; //TODO: move this? guess not if (waitTime > 0) { waiting = true; waitTime -= Gdx.graphics.getDeltaTime(); } if (gameMode == MODE_FIGHT && this.currentCombat.waitingForPlayerCommand) waiting = true; if (gameMode == MODE_VICTORY) { // "After Combat" screen if (currentCombat != null) { // clean up! //for(Sprite s : drawSprites){ //s.getTexture().dispose(); //} drawSprites.clear(); //TODO: display some info about the fight.. //TODO: give items and stuffs party.addExperience(currentCombat.setup.exp); currentCombat.cleanUp(); currentCombat = null; waitTime = 4f; waiting = true; this.backgroundTexture = new Texture(Gdx.files.internal("data/victory.png")); this.background = new Sprite(backgroundTexture, 0, 0, 480, 320); } if (!waiting || this.debug) { waiting = false; waitTime = 0; this.returnFromCombat(); return; // TODO: not sure if this is a good idea or bad } } else if (gameMode == MODE_GAMEOVER) { // Game over //TODO: write something 'nice' to the screen? this.backgroundTexture = new Texture(Gdx.files.internal("data/gameover.png")); this.background = new Sprite(backgroundTexture, 0, 0, 480, 320); this.drawSprites.clear(); } else if (gameMode == MODE_FIGHT) { // Re-position all creatures.. for (int i = 0; i < currentCombat.getLiveCombatants().size(); i++) { Combatant current = currentCombat.getLiveCombatants().get(i); switch (current.getTerminalState()) { case Combat.STATE_STONE: current.getSprite().setColor(Color.GRAY); // render as grey (as stone) break; case Combat.STATE_POISONED: current.getSprite().setColor(Color.GREEN); // render as green break; case Combat.STATE_FURY: current.getSprite().setColor(Color.RED); // render as red break; case Combat.STATE_WEAKNESS: current.getSprite().setColor(Color.YELLOW); // render as pale yellow break; case Combat.STATE_DOOM: current.getSprite().setColor(Color.BLACK); // render as dark break; default: current.getSprite().setColor(Color.WHITE); break; } } // carry out player commands if (this.currentCombat.waitingForPlayerCommand && this.finishedChoosing == true) { if (this.selectedCombatOption.subGroup == false && this.selectedCombatOption.hardCoded) { // player chose a hardcoded option. if (this.selectedCombatOption == ZombieLord.defend) { // TODO: defend if possible // For now, we just wait a turn when defending (so its near useless). this.currentCombat.resetActionTimer(this.combatOptionCaster); waiting = true; waitTime = 0.3f; this.currentCombat.waitingForPlayerCommand = false; this.selectedCombatOption = null; this.currentCombatOptions = null; this.combatOptionCaster = null; this.finishedTargeting = false; this.finishedChoosing = false; this.validTargets = null; this.selectedTarget = null; } else if (this.selectedCombatOption == ZombieLord.escape) { if (Math.random() < this.currentCombat.getEscapeChance()) { // escape! this.returnFromCombat(); return; } else { waiting = true; waitTime = 0.3f; this.currentCombat.waitingForPlayerCommand = false; this.selectedCombatOption = null; this.currentCombatOptions = null; this.combatOptionCaster = null; this.finishedTargeting = false; this.finishedChoosing = false; this.validTargets = null; this.selectedTarget = null; } } else if (this.selectedCombatOption == ZombieLord.item) { // have to pull up a submenu with all combat items. this.currentCombatOptions = new LinkedList<CombatOption>(); Inventory inventory = party.getInventory(); LinkedList<Item> items = inventory.getCombatItems(); for (Item i : items) { this.currentCombatOptions.add(new CombatOption(i)); } this.selectedCombatOption = this.currentCombatOptions.getFirst(); this.finishedChoosing = false; System.out.println("subgroup"); // TODO: make combatoptions for each combat item (+ count) // then serve to player just like with magics } } else if (this.selectedCombatOption.subGroup == false) { // player has selected an option which we can carry out.. so lets! if (!this.finishedTargeting && this.selectedTarget == null) { // TODO: well? if (this.selectedCombatOption.item == null) { // Not trying to use an item CombatAction action = this.selectedCombatOption.associatedActions.getFirst(); this.validTargets = this.currentCombat.getValidTargets(action, this.combatOptionCaster); // NOTE: for attacks that target 'all *' or 'random *', this is also fine and handled elsewhere. this.selectedTarget = validTargets.getFirst(); this.targeting = new Targeting(action.targetType, validTargets, this.combatOptionCaster, action.offensive); } else { // Trying to use an item // targeting for items is a little strange i guess.. if (this.selectedCombatOption.item instanceof ConsumeableItem) { ConsumeableItem item = (ConsumeableItem) this.selectedCombatOption.item; CombatAction action = item.getEffect(); this.validTargets = new LinkedList<Combatant>(); for (Combatant c : this.currentCombat.getLiveCombatants()) this.validTargets.add(c); if (item.offensive) { // target first enemy.. this.selectedTarget = this.currentCombat.getLiveMonsters().getFirst(); } else { // target self this.selectedTarget = this.combatOptionCaster; } System.out.println("item"); this.targeting = new Targeting(action.targetType, validTargets, this.combatOptionCaster, item.offensive); } else { // TODO: non-consumable items in combat? System.err.println( "[ERROR] Non consumeable item in combat? Have to write the code first then! 1"); } } } else if (this.finishedTargeting) { if (this.selectedCombatOption.item != null) { // player wants to use an item if (this.selectedCombatOption.item instanceof ConsumeableItem) { ConsumeableItem i = (ConsumeableItem) this.selectedCombatOption.item; CurrentAction myAction = new CurrentAction(i.getEffect(), this.combatOptionCaster, this.targeting); LinkedList<Combatant> affected = currentCombat.applyAction(myAction); myAction.caster.setMoveAhead(true); if (myAction.action.effect != null && affected != null) { for (Combatant c : affected) { Sprite effect = new Sprite(myAction.action.effect); effect.setX(c.getSprite().getX() + 16); effect.setY(c.getSprite().getY() + 16); this.combatEffects.add(effect); } } // take the item party.getInventory().removeItem(i, (byte) 1); this.currentCombat.resetActionTimer(this.combatOptionCaster); waiting = true; waitTime = 2; this.currentCombat.waitingForPlayerCommand = false; this.selectedCombatOption = null; this.currentCombatOptions = null; this.combatOptionCaster = null; this.finishedTargeting = false; this.finishedChoosing = false; this.validTargets = null; this.selectedTarget = null; } else { System.err.println( "[ERROR] Non consumeable item in combat? Have to write the code first then! 2"); } } else { CurrentAction myAction = new CurrentAction( this.selectedCombatOption.associatedActions.getFirst(), this.combatOptionCaster, this.targeting); LinkedList<Combatant> affected = currentCombat.applyAction(myAction); if (myAction.action != null && affected != null) { // Move player against monster to represent the attack if (myAction.caster == Tolinai) { // TODO: simple hack to get sound.. ZombieLord.playSound("data/sound/woodenstickattack.wav", 1f); } if (myAction.caster == Leoric) { // TODO: simple hack to get sound.. ZombieLord.playSound("data/sound/cut.wav", 1f); } announce(myAction.action.name); myAction.caster.setMoveAhead(true); if (myAction.action.effect != null && affected != null) { for (Combatant c : affected) { Sprite effect = new Sprite(myAction.action.effect); effect.setX(c.getSprite().getX() + 16); effect.setY(c.getSprite().getY() + 16); this.combatEffects.add(effect); } } } if (this.debug) { // time to stop this nonsense! for (Monster m : currentCombat.getLiveMonsters()) { m.health = 0; } } this.currentCombat.resetActionTimer(this.combatOptionCaster); waiting = true; waitTime = 2; this.currentCombat.waitingForPlayerCommand = false; this.selectedCombatOption = null; this.currentCombatOptions = null; this.combatOptionCaster = null; this.finishedTargeting = false; this.finishedChoosing = false; this.validTargets = null; this.selectedTarget = null; } } } else { // this action has a subgroup.. player needs to choose from these also LinkedList<CombatAction> actions = this.selectedCombatOption.associatedActions; this.currentCombatOptions = new LinkedList<CombatOption>(); for (CombatAction act : actions) this.currentCombatOptions.add(new CombatOption(act.name, act)); this.selectedCombatOption = this.currentCombatOptions.getFirst(); this.finishedChoosing = false; System.out.println("subgroup"); } } for (Combatant c : this.currentCombat.getCombatants()) { if (c.health <= 0) { // dead.. if (c instanceof PartyMember) { // TODO: some effect here } else if (c instanceof Monster) { Monster m = (Monster) c; if (m.alpha == Monster.ALPHA_START) { Color red = Color.RED; m.getSprite().setColor(red); } if (m.alpha > 0f) { m.alpha -= m.fadeSpeed * Gdx.graphics.getDeltaTime(); } if (m.alpha < 0) { m.alpha = 0; } } } } //check if battle is over. if (!waiting) { byte state = currentCombat.getBattleState(); for (int i = 0; i < currentCombat.getLiveCombatants().size(); i++) { currentCombat.getLiveCombatants().get(i).setMoveAhead(false); } this.combatEffects.clear(); if (state == 1) { // player has won // check if all monsters are done fading out.. boolean fadingDone = true; for (Combatant c : currentCombat.getCombatants()) if (c instanceof Monster && ((Monster) c).alpha != 0) fadingDone = false; if (fadingDone) { // WIN waiting = true; System.out.println("VICTORY! :>"); //TODO: happy trumpet gameMode = MODE_VICTORY; this.combatEffects.clear(); } // else, wait for fading to finish.. } else if (state == 2) { // player has lost this.gameOver(); } Monster readyMonster = currentCombat.getFirstReadiedMonster(); if (readyMonster != null && currentCombat.getLivePlayers().size() > 0) { CurrentAction myAction = readyMonster.getMonsterAction(party, currentCombat); LinkedList<Combatant> affected = currentCombat.applyAction(myAction); if (myAction.action != null) { // Move monster against player to represent the attack announce(myAction.action.name); myAction.caster.setMoveAhead(true); if (myAction.action.effect != null && affected != null) { if (myAction.action == BITE) { // TODO: simple hack to get sound.. ZombieLord.playSound("data/sound/zombiebite.wav", 1f); } if (myAction.action == PUNCH) { // TODO: simple hack to get sound.. ZombieLord.playSound("data/sound/woodenstickattack.wav", 1f); } for (Combatant c : affected) { Sprite effect = new Sprite(myAction.action.effect); effect.setX(c.getSprite().getX() + 16); effect.setY(c.getSprite().getY() + 16); this.combatEffects.add(effect); } } } readyMonster.actionTimer = readyMonster.getBaseDelay() * (1.5f * Math.random() + 0.5f);// TODO: randomize better? waiting = true; waitTime = 2; // Only 1 attacker per turn. } if (!waiting && currentCombat.getLiveMonsters().size() > 0) { PartyMember readyMember = currentCombat.getFirstReadiedPlayer(); if (readyMember != null) { // Find the options.. // find out which 'global groups are available.. boolean haveItem = currentCombat.isItemAllowed(); boolean canEscape = currentCombat.isEscapeAllowed(); boolean canDefend = false; // TODO: maybe have some setting to allow some of the characters to defend.. CombatAction attack = null; LinkedList<CombatAction> magic = new LinkedList<CombatAction>(); LinkedList<CombatAction> summons = new LinkedList<CombatAction>(); for (CombatAction ca : readyMember.getCombatActions()) { if (ca.category == ZombieLord.OFFENSIVE_MAGIC || ca.category == ZombieLord.DEFENSIVE_MAGIC) magic.add(ca); else if (ca.category == ZombieLord.ATTACK) attack = ca; else if (ca.category == ZombieLord.SUMMON) summons.add(ca); } this.currentCombatOptions = new LinkedList<CombatOption>(); this.selectedCombatOption = null; if (attack != null) currentCombatOptions.add(new CombatOption("Attack", attack)); if (canDefend) currentCombatOptions.add(ZombieLord.defend); if (magic.size() > 0) currentCombatOptions.add(new CombatOption("Magic", magic)); if (summons.size() > 0) currentCombatOptions.add(new CombatOption("Summon", summons)); if (haveItem) currentCombatOptions.add(ZombieLord.item); if (canEscape) currentCombatOptions.add(ZombieLord.escape); this.selectedCombatOption = this.currentCombatOptions.getFirst(); this.finishedChoosing = false; this.combatOptionCaster = readyMember; this.currentCombat.waitingForPlayerCommand = true; this.selectedTarget = null; this.finishedTargeting = false; this.validTargets = null; this.targeting = null; } } } leoricSprite.setRegion(0, 64 * 3, 64, 64); if (!waiting) { currentCombat.tick(Gdx.graphics.getDeltaTime() * 5 * 2); } } if (this.gameMode == MODE_ZOMBIE_DEFENSE || this.gameMode == MODE_FIGHT) { camera.position.x = w / 2f; camera.position.y = h / 2f; camera.update(); } //background = new Sprite(backgroundTexture, (int)(posx-w), (int)(posy-h), (int)(posx+w), (int)(posy+h)); Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(camera.combined); batch.begin(); background.draw(batch); if (this.gameMode == MODE_MOVE || this.gameMode == MODE_DIALOG) { // draw level objects if (this.levelObjects != null) { for (LevelObject object : this.levelObjects) { object.draw(batch); } } } for (Sprite s : drawSprites) s.draw(batch); if (gameMode == MODE_FIGHT) { this.battleWindow.draw(batch); this.drawCombatUISprites(batch); //LinkedList<Sprite> uiElements = this.getCombatUISprites(); //for(Sprite s : uiElements) // s.draw(batch); } if (animations.size() > 0) { ListIterator<TemporaryAnimation> lit = animations.listIterator(); while (lit.hasNext()) { TemporaryAnimation ta = lit.next(); if (ta.timeLeft <= 0) { lit.remove(); continue; } ta.sprite.setPosition(ta.x, ta.y); ta.sprite.draw(batch); ta.timeLeft -= Gdx.graphics.getDeltaTime(); } } if (animatedMissiles.size() > 0) { ListIterator<AnimatedMissile> it = animatedMissiles.listIterator(); while (it.hasNext()) { AnimatedMissile missile = it.next(); if (missile.hasArrived()) { // delete it.. missile.sprite = null; it.remove(); continue; } // TODO: use box2d to move the missiles instead? float xChange = 0; float yChange = 0; float reqX = missile.sprite.getX() - missile.toX; float reqY = missile.sprite.getY() - missile.toY; if (reqY == 0) reqY = 0.001f; float xyRate = Math.abs(reqX) / Math.abs(reqY); xChange = xyRate * missile.speed; yChange = 1 * missile.speed; if (reqX > 0) xChange *= -1; if (reqY > 0) yChange *= -1; missile.sprite.setX(missile.sprite.getX() + xChange); missile.sprite.setY(missile.sprite.getY() + yChange); missile.sprite.draw(batch); } } if (gameMode == MODE_ZOMBIE_DEFENSE) { // draw monies and helps //fontBatch.begin(); font.setColor(Color.WHITE); font.draw(batch, "Money: " + this.zombieDefense.money + ", Life: " + this.zombieDefense.getHealthLeft() + ", Wave: " + this.zombieDefense.getCurrentWaveNumber() + ".", 3, 18); //fontBatch.end(); // draw all the attackers.. this.tickZombieDefense(Gdx.graphics.getDeltaTime()); for (Attacker atk : this.zombieDefense.attackers) { atk.draw(batch, Gdx.graphics.getDeltaTime()); barHp.draw(batch, atk.getX() * 32 + 8, atk.getY() * 32, (float) ((atk.health + 0.0) / atk.healthMax) * 20, 3); } for (Defender def : this.zombieDefense.defenders) { def.draw(batch, Gdx.graphics.getDeltaTime()); barHp.draw(batch, def.getX() * 32 + 8, def.getY() * 32, (float) ((def.health + 0.0) / def.healthMax) * 20, 3); } this.zombieDefense.cursor.draw(batch); } if (gameMode == MODE_MOVE && this.foreground != null) // drawing foreground last = ontop of everything else foreground.draw(batch); if (gameMode == MODE_FIGHT) { for (Combatant monst : this.currentCombat.getCombatants()) { if (monst instanceof Monster) { Monster m = (Monster) monst; // draw the monster with correct alpha.. // thus we can fade out dead monsters m.getSprite().draw(batch, m.alpha); } } // draw battle effects last.. unless you dont want them ontop anymore.. for (Sprite effect : this.combatEffects) effect.draw(batch); } batch.end(); if (!floatingNumbers.isEmpty()) { ListIterator<FloatingNumber> lit = floatingNumbers.listIterator(); fontBatch.begin(); while (lit.hasNext()) { FloatingNumber f = lit.next(); // draw, then tick, then maybe delete Color myColor = new Color(f.color); // TODO: fade when timeleft is close to zero if (f.timeLeft < 1) myColor.a = f.timeLeft; font.setColor(myColor); font.draw(fontBatch, "" + f.number, (int) f.posx, (int) f.posy); f.tick(Gdx.graphics.getDeltaTime()); font.setColor(Color.WHITE); if (f.deleteNow) lit.remove(); } fontBatch.end(); } if (announcement != null) { if (announcementTimeout > 0) { fontBatch.begin(); announcementBackground.draw(fontBatch, w / 2 - announcement.length() * 6 - 4, h - 24 - 13, announcement.length() * 13, 20 + 2); font.setColor(Color.WHITE); font.draw(fontBatch, announcement, w / 2 - announcement.length() * 6, h - 24); announcementTimeout -= Gdx.graphics.getDeltaTime(); fontBatch.end(); } } if (gameMode == MODE_FIGHT && this.currentCombat.waitingForPlayerCommand) { fontBatch.begin(); if (this.finishedChoosing && !this.finishedTargeting) { // NOTE, for 'all * and random *' selectedTarget is wrong, but. we know how to draw those i guess.. LinkedList<Combatant> targets = targeting.getCurrentTargets(); //one hand for each target for (Combatant c : targets) { Sprite cursor = new Sprite(this.selectionHand, 0, 0, 32, 32); cursor.setX(c.getSprite().getX()); cursor.setY(c.getSprite().getY()); cursor.draw(fontBatch); } } int offset = 16; int curOffset = 0; for (CombatOption opt : this.currentCombatOptions) { font.setColor(Color.WHITE); if (this.currentCombat.canUse(opt, this.combatOptionCaster)) { if (this.selectedCombatOption == opt) font.setColor(Color.YELLOW); else font.setColor(Color.WHITE); } else { if (this.selectedCombatOption == opt) font.setColor(Color.RED); else font.setColor(Color.GRAY); } String t = opt.name; if (opt.item != null) t = party.getInventory().getItemCount(opt.item) + "x " + opt.name; font.draw(fontBatch, t, w / 4, h / 2 - curOffset); curOffset += offset; } fontBatch.end(); font.setColor(Color.WHITE); } if (gameMode == MODE_DIALOG && this.curSpeaker != null) { fontBatch.begin(); // Ongoing dialog, draw the talkstuffs // TODO: draw current speakers portrait? int slength = -1; for (int i = 0; i < this.curSentence.length; i++) { slength += this.curSentence[i].length() + 1; //System.out.println("_"+this.curSentence[i]+"_"); } int length = this.curSpeaker.length() + 2 + slength; float cposx = w / 2; float cposy = h / 3; if (this.curSpeaker.equals("Leoric")) { Sprite face = new Sprite(Leoric.getFace()); //face.scale(-0.4f); face.setPosition(5, cposy + 32 + 32); face.draw(fontBatch); } else if (this.curSpeaker.equals("Tolinai")) { Sprite face = new Sprite(Tolinai.getFace()); //face.scale(-0.4f); face.setPosition(5, cposy + 32 + 32); face.draw(fontBatch); } if (length > 32) { // needs to be split //int remain = length; //int num = 0; //int start = 0; int startWord = 0; int maxLength = 0; int remainWords = this.curSentence.length; LinkedList<StringBuilder> sbl = new LinkedList<StringBuilder>(); while (remainWords > 0) { /*int printed = Math.min(32, remain); int first = start; int lastMinusOne = start+printed;*/ StringBuilder sb = new StringBuilder(); int numLetters = 0; int numWords = 0; for (int i = startWord; i < this.curSentence.length; i++) { if (numLetters + this.curSentence[i].length() + (startWord == 0 ? this.curSpeaker.length() : 1) > 32) { break; } else { if (i != 0 && numWords != 0) sb.append(" "); sb.append(this.curSentence[i]); numLetters = sb.length(); numWords++; } } sbl.add(sb); /*remain -= printed; start += printed;*/ remainWords -= numWords; startWord += numWords; if (numLetters > maxLength) maxLength = numLetters; } dialogBackground.draw(fontBatch, 0, cposy + h / 2 - h / 3 - 16 - (16 * (int) Math.floor(length / 32)), 32 * 13 + 5, 20 + (16 * (length / 32)) + 2); int tickerLimit = (int) this.dialogTicker; for (int i = 0; i < sbl.size(); i++) { if (tickerLimit <= 0) { break; } String mystr = sbl.get(i).toString(); if (mystr.length() > tickerLimit) { // delete overflowing text StringBuilder tmp = new StringBuilder(); for (int j = 0; j < tickerLimit; j++) { tmp.append(mystr.charAt(j)); } mystr = tmp.toString(); tickerLimit = 0; } tickerLimit -= mystr.length(); font.draw(fontBatch, (i == 0 ? this.curSpeaker + ": " : "") + mystr, cposx - w / 2 + (i == 0 ? 0 : 30), cposy + h / 2 - h / 3 - (i * 16)); } } else { // print everything in one go StringBuilder all = new StringBuilder(); for (int i = 0; i < this.curSentence.length; i++) { if (i > 0) { all.append(" "); } all.append(curSentence[i]); } dialogBackground.draw(fontBatch, 0, cposy + h / 2 - h / 3 - 16, length * 13, 20 + 2); int tickerLimit = (int) this.dialogTicker; String mystr = all.toString(); if (mystr.length() > tickerLimit) { // delete overflowing text StringBuilder tmp = new StringBuilder(); for (int j = 0; j < tickerLimit; j++) { tmp.append(mystr.charAt(j)); } mystr = tmp.toString(); } font.draw(fontBatch, this.curSpeaker + ": " + mystr, cposx - w / 2, cposy + h / 2 - h / 3); } fontBatch.end(); } else if (this.menu != null) { fontBatch.begin(); menu.draw(fontBatch); fontBatch.end(); } if (debug && world != null && debugRenderer != null) debugRenderer.render(world, camera.combined.scale(PIXELS_PER_METER, PIXELS_PER_METER, PIXELS_PER_METER)); }
From source file:com.theosirian.ppioo.controllers.PlayerSelectionController.java
License:Open Source License
@Override protected void buildUI() { rootLayout.clear();//ww w . j ava 2 s.c om 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();// www . j ava 2 s . c o 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(); }
From source file:com.theosirian.ppioo.util.GUI.java
License:Open Source License
public static void configureSkin(Skin skin) { if (skin == null) { return;// ww w . j av a 2s . c om } loadResources(skin); loadLabels(skin); loadButtons(skin); ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle(); scrollPaneStyle.background = skin.newDrawable("white", Color.BLACK); scrollPaneStyle.hScroll = skin.newDrawable("white8x1", Color.GRAY); scrollPaneStyle.hScrollKnob = skin.newDrawable("white8x1", Color.WHITE); scrollPaneStyle.vScroll = skin.newDrawable("white1x8", Color.GRAY); scrollPaneStyle.vScrollKnob = skin.newDrawable("white1x8", Color.WHITE); scrollPaneStyle.corner = skin.newDrawable("white", Color.GRAY); skin.add("default", scrollPaneStyle); CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle(); checkBoxStyle.font = skin.getFont("default"); checkBoxStyle.fontColor = Color.BLACK; checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on"); checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled"); checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off"); checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled"); skin.add("default", checkBoxStyle); checkBoxStyle = new CheckBox.CheckBoxStyle(); checkBoxStyle.font = skin.getFont("default"); checkBoxStyle.fontColor = Color.BLACK; checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on.slider.horizontal"); //checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled"); checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off.slider.horizontal"); //checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled"); skin.add("slider.horizontal", checkBoxStyle); Window.WindowStyle dialogStyle = new Window.WindowStyle(); dialogStyle.background = skin.newDrawable("window"); dialogStyle.stageBackground = skin.newDrawable("white", Color.valueOf("00000080")); dialogStyle.titleFont = skin.getFont("medium"); dialogStyle.titleFontColor = Color.BLACK; skin.add("default", dialogStyle); ImageButton.ImageButtonStyle upButtonStyle = new ImageButton.ImageButtonStyle(); upButtonStyle.imageUp = skin.getDrawable("arrow.up"); upButtonStyle.imageDown = skin.getDrawable("arrow.up"); upButtonStyle.imageDisabled = skin.getDrawable("arrow.up.disabled"); skin.add("arrow.up", upButtonStyle); ImageButton.ImageButtonStyle downButtonStyle = new ImageButton.ImageButtonStyle(); downButtonStyle.imageUp = skin.getDrawable("arrow.down"); downButtonStyle.imageDown = skin.getDrawable("arrow.down"); downButtonStyle.imageDisabled = skin.getDrawable("arrow.down.disabled"); skin.add("arrow.down", downButtonStyle); ImageButton.ImageButtonStyle radioButtonStyle = new ImageButton.ImageButtonStyle(); radioButtonStyle.imageUp = skin.getDrawable("radiobutton.off"); radioButtonStyle.imageOver = skin.getDrawable("radiobutton.off.over"); radioButtonStyle.imageChecked = skin.getDrawable("radiobutton.on"); radioButtonStyle.imageCheckedOver = skin.getDrawable("radiobutton.on.over"); radioButtonStyle.imageDisabled = skin.getDrawable("radiobutton.disabled"); skin.add("radiobutton", radioButtonStyle); ImageButton.ImageButtonStyle soundButtonOn = new ImageButton.ImageButtonStyle(); soundButtonOn.imageUp = skin.getDrawable("sound-on"); soundButtonOn.imageChecked = skin.getDrawable("sound-on"); skin.add("sound-on", soundButtonOn); ImageButton.ImageButtonStyle soundButtonOff = new ImageButton.ImageButtonStyle(); soundButtonOff.imageUp = skin.getDrawable("sound-off"); soundButtonOff.imageChecked = skin.getDrawable("sound-off"); skin.add("sound-off", soundButtonOff); }
From source file:com.torrosoft.sopistan.SopistanMain.java
License:Open Source License
void drawDebug() { Array<Vector2> input = swipe.getInput(); // draw the raw input shapes.begin(ShapeType.Line); shapes.setColor(Color.GRAY); for (int i = 0; i < input.size - 1; i++) { Vector2 p = input.get(i); Vector2 p2 = input.get(i + 1); shapes.line(p.x, p.y, p2.x, p2.y); }/*from ww w.j a va 2s.c o m*/ shapes.end(); // draw the smoothed and simplified path shapes.begin(ShapeType.Line); shapes.setColor(Color.RED); Array<Vector2> out = swipe.getPath(); for (int i = 0; i < out.size - 1; i++) { Vector2 p = out.get(i); Vector2 p2 = out.get(i + 1); shapes.line(p.x, p.y, p2.x, p2.y); } shapes.end(); // render our perpendiculars shapes.begin(ShapeType.Line); Vector2 perp = new Vector2(); for (int i = 1; i < input.size - 1; i++) { Vector2 p = input.get(i); Vector2 p2 = input.get(i + 1); shapes.setColor(Color.LIGHT_GRAY); perp.set(p).sub(p2).nor(); perp.set(perp.y, -perp.x); perp.scl(10f); shapes.line(p.x, p.y, p.x + perp.x, p.y + perp.y); perp.scl(-1f); shapes.setColor(Color.BLUE); shapes.line(p.x, p.y, p.x + perp.x, p.y + perp.y); } shapes.end(); }
From source file:com.tumblr.oddlydrawn.stupidworm.Renderer.java
License:Apache License
private void renderWorld() { // walls// ww w . ja va 2 s. com shapeRenderer.setColor(Color.GRAY); for (int y = Level.TILES_HEIGHT - 1; y >= 0; y--) { for (int x = 0; x < Level.TILES_WIDTH; x++) { if (levelArray[x][y] == Level.WALL) { rect.x = x * Level.SIZE; rect.y = y * Level.SIZE; rect.width = Level.SIZE; rect.height = Level.SIZE; shapeRenderer.rect(rect.x, rect.y, rect.width, rect.height); } } } }
From source file:com.vlaaad.common.gdx.State.java
License:Open Source License
protected Color getBackgroundColor() { return Color.GRAY; }
From source file:com.vlaaad.dice.services.AchievementDescriptionView.java
License:Open Source License
public AchievementDescriptionView(Achievement achievement) { super(Config.skin); this.achievement = achievement; defaults().pad(2);/*from www . ja va 2s . c o m*/ setTouchable(Touchable.disabled); setBackground("particle-white-pixel"); // add(new Tile("achievement/" + achievement.name)); add(new LocLabel(/*"achievement-" + */achievement.name, achievement.isUnlocked() ? Color.BLACK : Color.GRAY)).expand().padTop(-1).row(); // LocLabel description = new LocLabel("achievement-" + achievement.name, Color.GRAY); // description.setWrap(true); // add(description).expand().padTop(-1).colspan(2).row(); setWidth(153); }