Java Code Examples for org.newdawn.slick.Color#green()
The following examples show how to use
org.newdawn.slick.Color#green() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ButtonMenu.java From opsu-dance with GNU General Public License v3.0 | 6 votes |
@Override public void render(Graphics g) { // score multiplier (TODO: fade in color changes) float mult = GameMod.getScoreMultiplier(); String multString = String.format("Score Multiplier: %.2fx", mult); Color multColor = (mult == 1f) ? Color.white : (mult > 1f) ? Color.green : Color.red; float multY = Fonts.LARGE.getLineHeight() * 2 + height * 0.06f; final float multX = width2 - Fonts.LARGE.getWidth(multString) / 2f; Fonts.LARGE.drawString(multX, multY, multString, multColor); // category text for (GameMod.Category category : GameMod.Category.values()) { Fonts.LARGE.drawString(category.getX(), category.getY() - Fonts.LARGE.getLineHeight() / 2f, category.getName(), category.getColor()); } // buttons for (GameMod mod : GameMod.values()) mod.draw(); super.render(g); }
Example 2
Source File: OverworldEndTransition.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 6 votes |
public void render() { String string = winner+" is the winner!"; int width = FEResources.getBitmapFont("default_med").getStringWidth(string); Transform t = new Transform(); t.scaleX = 2; t.scaleY = 2; t.color = Color.green; Renderer.drawString("default_med", string, 240-width, 130, 0.1f, t); timer += Game.getDeltaSeconds(); if(timer > 3.0f) { Renderer.translate(0,endPos); to.render(); Renderer.translate(0, -endPos); endPos += Game.getDeltaSeconds()*600; if(endPos > 0) done(); } }
Example 3
Source File: RendererSlick.java From nullpomino with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static Color getMeterColorAsColor(int meterColor) { switch(meterColor) { case GameEngine.METER_COLOR_PINK: return new Color(255, 0,255); case GameEngine.METER_COLOR_PURPLE: return new Color(128, 0,255); case GameEngine.METER_COLOR_DARKBLUE: return new Color( 0, 0,128); case GameEngine.METER_COLOR_BLUE: return Color.blue; case GameEngine.METER_COLOR_CYAN: return Color.cyan; case GameEngine.METER_COLOR_DARKGREEN: return new Color( 0,128, 0); case GameEngine.METER_COLOR_GREEN: return Color.green; case GameEngine.METER_COLOR_YELLOW: return Color.yellow; case GameEngine.METER_COLOR_ORANGE: return Color.orange; case GameEngine.METER_COLOR_RED: return Color.red; } return Color.white; }
Example 4
Source File: OverworldEndTransition.java From FEMultiplayer with GNU General Public License v3.0 | 6 votes |
public void render() { String string = winner+" is the winner!"; int width = FEResources.getBitmapFont("default_med").getStringWidth(string); Transform t = new Transform(); t.scaleX = 2; t.scaleY = 2; t.color = Color.green; Renderer.drawString("default_med", string, 240-width, 130, 0.1f, t); timer += Game.getDeltaSeconds(); if(timer > 3.0f) { Renderer.translate(0,endPos); to.render(); Renderer.translate(0, -endPos); endPos += Game.getDeltaSeconds()*600; if(endPos > 0) done(); } }
Example 5
Source File: GradientTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer) */ public void init(GameContainer container) throws SlickException { this.container = container; rect = new Rectangle(400,100,200,150); round = new RoundedRectangle(150,100,200,150,50); round2 = new RoundedRectangle(150,300,200,150,50); center = new Rectangle(350,250,100,100); poly = new Polygon(); poly.addPoint(400,350); poly.addPoint(550,320); poly.addPoint(600,380); poly.addPoint(620,450); poly.addPoint(500,450); gradient = new GradientFill(0,-75,Color.red,0,75,Color.yellow,true); gradient2 = new GradientFill(0,-75,Color.blue,0,75,Color.white,true); gradient4 = new GradientFill(-50,-40,Color.green,50,40,Color.cyan,true); }
Example 6
Source File: GeomAccuracyTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Used to set the colors for overlay and geometry * */ private void setColors() { switch(colorIndex) { case 0: overlayColor = Color.white; geomColor = Color.magenta; break; case 1: overlayColor = Color.magenta; geomColor = Color.white; break; case 2: overlayColor = Color.red; geomColor = Color.green; break; case 3: overlayColor = Color.red; geomColor = Color.white; break; } }
Example 7
Source File: RendererSlick.java From nullpomino with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Block colorIDDepending onSlickUseColorObjects created or received * @param colorID Block colorID * @return SlickUseColorObject */ public static Color getColorByID(int colorID) { switch(colorID) { case Block.BLOCK_COLOR_GRAY: return new Color(Color.gray); case Block.BLOCK_COLOR_RED: return new Color(Color.red); case Block.BLOCK_COLOR_ORANGE: return new Color(255,128,0); case Block.BLOCK_COLOR_YELLOW: return new Color(Color.yellow); case Block.BLOCK_COLOR_GREEN: return new Color(Color.green); case Block.BLOCK_COLOR_CYAN: return new Color(Color.cyan); case Block.BLOCK_COLOR_BLUE: return new Color(Color.blue); case Block.BLOCK_COLOR_PURPLE: return new Color(Color.magenta); } return new Color(Color.black); }
Example 8
Source File: ButtonMenu.java From opsu with GNU General Public License v3.0 | 5 votes |
@Override public void draw(GameContainer container, StateBasedGame game, Graphics g) { int width = container.getWidth(); int height = container.getHeight(); // score multiplier (TODO: fade in color changes) float mult = GameMod.getScoreMultiplier(); String multString = String.format("Score Multiplier: %.2fx", mult); Color multColor = (mult == 1f) ? Color.white : (mult > 1f) ? Color.green : Color.red; float multY = Fonts.LARGE.getLineHeight() * 2 + height * 0.06f; Fonts.LARGE.drawString( (width - Fonts.LARGE.getWidth(multString)) / 2f, multY, multString, multColor); // category text for (GameMod.Category category : GameMod.Category.values()) { Fonts.LARGE.drawString(category.getX(), category.getY() - Fonts.LARGE.getLineHeight() / 2f, category.getName(), category.getColor()); } // buttons for (GameMod mod : GameMod.values()) mod.draw(); super.draw(container, game, g); }
Example 9
Source File: CubicStoryboardMover.java From opsu-dance with GNU General Public License v3.0 | 4 votes |
public CubicStoryboardMover() { super(Color.green, Color.orange); }
Example 10
Source File: TeamDraftStage.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
/** * Instantiates a new team draft stage. * * @param s the s */ public TeamDraftStage(Session s){ super("preparations"); cursor = new Cursor(); this.session = s; lastAction = ""; controls = new ControlsDisplay(); controls.addControl("Z", "Select"); controls.addControl("Enter", "Done"); addEntity(controls); hasControl = true; addEntity(new RunesBg(new Color(0xd2b48c))); List<Unit> vassals = UnitFactory.getVassals(); List<Unit> lords = UnitFactory.getLords(); lordList = new UnitList(LORD_LIST_X, LORD_LIST_Y, 2, 4); lordList.addUnits(lords); addEntity(lordList); vassalList = new UnitList(UNIT_LIST_X, UNIT_LIST_Y, 5, 4); vassalList.addUnits(vassals); vassalList.sort(new SortByName()); addEntity(vassalList); classSort = new Button(CS_BUTTON_X, BUTTON_Y, "Sort By Class", Color.blue, 95) { public void execute() { vassalList.sort(new SortByClass()); vassalList.refresh(); } }; nameSort = new Button(NS_BUTTON_X, BUTTON_Y, "Sort By Name", Color.blue, 95) { public void execute() { vassalList.sort(new SortByName()); vassalList.refresh(); } }; submit = new Button(SB_BUTTON_X, BUTTON_Y, "Submit", Color.green, 95) { public void execute() { List<String> units = new ArrayList<String>(); for(Unit u : lordList.getSelectedUnits()) { units.add(u.name); } for(Unit u : vassalList.getSelectedUnits()) { units.add(u.name); } if(units.size() < maxLords + maxVassals) { return; } DraftMessage msg = new DraftMessage(units.toArray(new String[units.size()])); FEMultiplayer.getClient().sendMessage(msg); hasControl = false; } }; buttons = new Button[3]; buttons[1] = nameSort; buttons[2] = classSort; buttons[0] = submit; addEntity(cursor); addEntity(classSort); addEntity(nameSort); addEntity(submit); Collections.shuffle(vassals); Collections.shuffle(lords); // Draft order initialization // [Blue/Red] [Lord, Ban, Pick] draftOrder = draftOrders[session.getMaxUnits()-1]; draftTurn = -1; // Timers timers = new ArrayList<DraftTimer>(); for(Player p : session.getNonSpectators()) { int x = p.getParty().getColor().equals(Party.TEAM_BLUE) ? 5 : 410; float totalTime = Math.round(TIME_PER_TURN * draftOrder.length / 5.0f) * 5 + BASE_TIME; DraftTimer dt = new DraftTimer(x, 277, totalTime, Math.round(totalTime/12), p); addEntity(dt); timers.add(dt); } resetDraft(); refresh(); }
Example 11
Source File: UnitBuilderStage.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
/** * Instantiates a new unit builder stage. * * @param u the u * @param s the s * @param session the session */ public UnitBuilderStage(Unit u, TeamBuilderStage s, Session session){ super("preparations"); addEntity(new RunesBg(new Color(0xd2b48c))); back = s; unit = u; inv = new InventoryMenu(u, INVENTORY_X, INVENTORY_Y){{ drawCost = true; setWidth(135); }}; addEntity(inv); controls = new ControlsDisplay(); controls.addControl("Z", "Buy"); controls.addControl("X", "Back"); addEntity(controls); UnitInfo ui = new UnitInfo(5,5); ui.setUnit(u); addEntity(ui); shop = new ShopMenu(SHOP_X, SHOP_Y, (session != null ? session.getModifiers() : java.util.Collections.emptySet())); shop.clearSelection(); addEntity(shop); levelUp = new Button(LEVEL_X, LEVEL_Y, "Level Up", Color.green, 135){ public void onStep(){ String exp = Unit.getExpCost(unit.getLevel() + 1)+""; if(unit.getLevel() == 20) exp = "--"; text = "Level Up: " +exp + " EXP"; } public void execute() { if(unit.getLevel() != 20){ int cost = Unit.getExpCost(unit.getLevel() + 1); if(cost <= back.getExp()){ unit.setLevel(unit.getLevel() + 1); back.setExp(back.getExp() - cost); } } } }; levelDown = new Button(LEVEL_X, LEVEL_Y + 24, "Level Down", Color.red, 135){ public void onStep(){ String exp = Unit.getExpCost(unit.getLevel())+""; if(unit.getLevel() == 1) exp = "--"; text = "Level Down: " + exp + " EXP"; } public void execute() { if(unit.getLevel() != 1){ int cost = Unit.getExpCost(unit.getLevel()); unit.setLevel(unit.getLevel()-1); back.setExp(back.getExp() + cost); } } };; addEntity(levelUp); addEntity(levelDown); state = new Normal(); }
Example 12
Source File: DraftViewStage.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
/** * Instantiates a new team draft stage. * * @param s the s */ public DraftViewStage(Session s){ super("preparations"); this.session = s; lastAction = ""; controls = new ControlsDisplay(); controls.addControl("Z", "Select"); controls.addControl("Enter", "Done"); addEntity(controls); hasControl = true; addEntity(new RunesBg(new Color(0xd2b48c))); List<Unit> vassals = UnitFactory.getVassals(); List<Unit> lords = UnitFactory.getLords(); lordList = new UnitList(LORD_LIST_X, LORD_LIST_Y, 2, 4); lordList.addUnits(lords); addEntity(lordList); vassalList = new UnitList(UNIT_LIST_X, UNIT_LIST_Y, 5, 4); vassalList.addUnits(vassals); vassalList.sort(new SortByName()); addEntity(vassalList); classSort = new Button(CS_BUTTON_X, BUTTON_Y, "Sort By Class", Color.blue, 95) { public void execute() { vassalList.sort(new SortByClass()); vassalList.refresh(); } }; nameSort = new Button(NS_BUTTON_X, BUTTON_Y, "Sort By Name", Color.blue, 95) { public void execute() { vassalList.sort(new SortByName()); vassalList.refresh(); } }; submit = new Button(SB_BUTTON_X, BUTTON_Y, "Submit", Color.green, 95) { public void execute() { List<String> units = new ArrayList<String>(); for(Unit u : lordList.getSelectedUnits()) { units.add(u.name); } for(Unit u : vassalList.getSelectedUnits()) { units.add(u.name); } if(units.size() < maxLords + maxVassals) { return; } DraftMessage msg = new DraftMessage(units.toArray(new String[units.size()])); FEMultiplayer.getClient().sendMessage(msg); hasControl = false; } }; buttons = new Button[3]; buttons[1] = nameSort; buttons[2] = classSort; buttons[0] = submit; addEntity(classSort); addEntity(nameSort); addEntity(submit); Collections.shuffle(vassals); Collections.shuffle(lords); // Draft order initialization // [Blue/Red] [Lord, Ban, Pick] draftOrder = draftOrders[session.getMaxUnits()-1]; draftTurn = -1; // Timers timers = new ArrayList<DraftTimer>(); for(Player p : session.getNonSpectators()) { int x = p.getParty().getColor().equals(Party.TEAM_BLUE) ? 5 : 410; float totalTime = Math.round(TIME_PER_TURN * draftOrder.length / 5.0f) * 5 + BASE_TIME; DraftTimer dt = new DraftTimer(x, 277, totalTime, Math.round(totalTime/12), p); addEntity(dt); timers.add(dt); } resetDraft(); refresh(); }
Example 13
Source File: TeamSelectionStage.java From FEMultiPlayer-V2 with GNU General Public License v3.0 | 4 votes |
/** * Instantiates a new team selection stage. * * @param stage the stage * @param s the s */ public TeamSelectionStage(TeamBuilderStage stage, Session s){ super("preparations"); builderStage = stage; if(s == null) maxUnits = 8; else maxUnits = s.getMaxUnits(); cursor = new Cursor(); controls = new ControlsDisplay(); controls.addControl("Z", "Select"); controls.addControl("Enter", "Done"); addEntity(controls); addEntity(new RunesBg(new Color(0xd2b48c))); List<Unit> vassals = UnitFactory.getVassals(); List<Unit> lords = UnitFactory.getLords(); lordList = new UnitList(LORD_LIST_X, LORD_LIST_Y, 2, 5); lordList.addUnits(lords); addEntity(lordList); vassalList = new UnitList(UNIT_LIST_X, UNIT_LIST_Y, 5, 5); vassalList.addUnits(vassals); vassalList.sort(new SortByName()); addEntity(vassalList); ok = new Button(OK_BUTTON_X, BUTTON_Y, "OK", Color.green, 95) { public void execute() { builderStage.setUnits(getSelectedUnits()); builderStage.refresh(); FEMultiplayer.setCurrentStage(builderStage); } }; classSort = new Button(CS_BUTTON_X, BUTTON_Y, "Sort By Class", Color.blue, 95) { public void execute() { vassalList.sort(new SortByClass()); vassalList.refresh(); } }; nameSort = new Button(NS_BUTTON_X, BUTTON_Y, "Sort By Name", Color.blue, 95) { public void execute() { vassalList.sort(new SortByName()); vassalList.refresh(); } }; buttons = new Button[3]; buttons[0] = ok; buttons[1] = nameSort; buttons[2] = classSort; addEntity(cursor); addEntity(ok); addEntity(classSort); addEntity(nameSort); Collections.shuffle(vassals); Collections.shuffle(lords); for(int i = 0; i < maxUnits-1; i++){ selectUnit(vassals.get(i)); } selectUnit(lords.get(0)); refresh(); }
Example 14
Source File: TeamDraftStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
public TeamDraftStage(Session s){ super("preparations"); cursor = new Cursor(); this.session = s; lastAction = ""; controls = new ControlsDisplay(); controls.addControl("Z", "Select"); controls.addControl("Enter", "Done"); addEntity(controls); hasControl = true; addEntity(new RunesBg(new Color(0xd2b48c))); List<Unit> vassals = UnitFactory.getVassals(); List<Unit> lords = UnitFactory.getLords(); lordList = new UnitList(LORD_LIST_X, LORD_LIST_Y, 2, 4); lordList.addUnits(lords); addEntity(lordList); vassalList = new UnitList(UNIT_LIST_X, UNIT_LIST_Y, 5, 4); vassalList.addUnits(vassals); vassalList.sort(new SortByName()); addEntity(vassalList); //TODO: Modifiers // if(s != null) { // for(Modifier m : s.getModifiers()) { // m.modifyUnits(this); // } // } classSort = new Button(CS_BUTTON_X, BUTTON_Y, "Sort By Class", Color.blue, 95) { public void execute() { vassalList.sort(new SortByClass()); vassalList.refresh(); } }; nameSort = new Button(NS_BUTTON_X, BUTTON_Y, "Sort By Name", Color.blue, 95) { public void execute() { vassalList.sort(new SortByName()); vassalList.refresh(); } }; submit = new Button(SB_BUTTON_X, BUTTON_Y, "Submit", Color.green, 95) { public void execute() { List<String> units = new ArrayList<String>(); for(Unit u : lordList.getSelectedUnits()) { units.add(u.name); } for(Unit u : vassalList.getSelectedUnits()) { units.add(u.name); } if(units.size() < maxLords + maxVassals) { return; } DraftMessage msg = new DraftMessage(units.toArray(new String[units.size()])); FEMultiplayer.getClient().sendMessage(msg); hasControl = false; } }; buttons = new Button[3]; buttons[1] = nameSort; buttons[2] = classSort; buttons[0] = submit; addEntity(cursor); addEntity(classSort); addEntity(nameSort); addEntity(submit); Collections.shuffle(vassals); Collections.shuffle(lords); // Draft order initialization // [Blue/Red] [Lord, Ban, Pick] draftOrder = draftOrders[session.getMaxUnits()-1]; draftTurn = -1; // Timers timers = new ArrayList<DraftTimer>(); for(Player p : session.getPlayers()) { if(p.isSpectator()) continue; int x = p.getParty().getColor().equals(Party.TEAM_BLUE) ? 5 : 410; float totalTime = Math.round(TIME_PER_TURN * draftOrder.length / 5.0f) * 5 + BASE_TIME; DraftTimer dt = new DraftTimer(x, 277, totalTime, Math.round(totalTime/12), p); addEntity(dt); timers.add(dt); } resetDraft(); refresh(); }
Example 15
Source File: UnitBuilderStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
public UnitBuilderStage(Unit u, TeamBuilderStage s, Session session){ super("preparations"); addEntity(new RunesBg(new Color(0xd2b48c))); back = s; unit = u; inv = new InventoryMenu(u, INVENTORY_X, INVENTORY_Y){{ drawCost = true; setWidth(135); }}; addEntity(inv); controls = new ControlsDisplay(); controls.addControl("Z", "Buy"); controls.addControl("X", "Back"); addEntity(controls); UnitInfo ui = new UnitInfo(5,5); ui.setUnit(u); addEntity(ui); shop = new ShopMenu(SHOP_X, SHOP_Y, session); shop.clearSelection(); addEntity(shop); levelUp = new Button(LEVEL_X, LEVEL_Y, "Level Up", Color.green, 135){ public void onStep(){ String exp = Unit.getExpCost(unit.get("Lvl") + 1)+""; if(unit.get("Lvl") == 20) exp = "--"; text = "Level Up: " +exp + " EXP"; } public void execute() { if(unit.get("Lvl") != 20){ int cost = Unit.getExpCost(unit.get("Lvl") + 1); if(cost <= back.getExp()){ unit.setLevel(unit.get("Lvl") + 1); back.setExp(back.getExp() - cost); } } } }; levelDown = new Button(LEVEL_X, LEVEL_Y + 24, "Level Down", Color.red, 135){ public void onStep(){ String exp = Unit.getExpCost(unit.get("Lvl"))+""; if(unit.get("Lvl") == 1) exp = "--"; text = "Level Down: " + exp + " EXP"; } public void execute() { if(unit.get("Lvl") != 1){ int cost = Unit.getExpCost(unit.get("Lvl")); unit.setLevel(unit.get("Lvl")-1); back.setExp(back.getExp() + cost); } } };; addEntity(levelUp); addEntity(levelDown); state = new Normal(); }
Example 16
Source File: TeamSelectionStage.java From FEMultiplayer with GNU General Public License v3.0 | 4 votes |
public TeamSelectionStage(TeamBuilderStage stage, Session s){ super("preparations"); builderStage = stage; if(s == null) maxUnits = 8; else maxUnits = s.getMaxUnits(); cursor = new Cursor(); controls = new ControlsDisplay(); controls.addControl("Z", "Select"); controls.addControl("Enter", "Done"); addEntity(controls); addEntity(new RunesBg(new Color(0xd2b48c))); List<Unit> vassals = UnitFactory.getVassals(); List<Unit> lords = UnitFactory.getLords(); lordList = new UnitList(LORD_LIST_X, LORD_LIST_Y, 2, 5); lordList.addUnits(lords); addEntity(lordList); vassalList = new UnitList(UNIT_LIST_X, UNIT_LIST_Y, 5, 5); vassalList.addUnits(vassals); vassalList.sort(new SortByName()); addEntity(vassalList); if(s != null) { for(Modifier m : s.getModifiers()) { m.modifyUnits(this); } } ok = new Button(OK_BUTTON_X, BUTTON_Y, "OK", Color.green, 95) { public void execute() { builderStage.setUnits(getSelectedUnits()); builderStage.refresh(); FEMultiplayer.setCurrentStage(builderStage); } }; classSort = new Button(CS_BUTTON_X, BUTTON_Y, "Sort By Class", Color.blue, 95) { public void execute() { vassalList.sort(new SortByClass()); vassalList.refresh(); } }; nameSort = new Button(NS_BUTTON_X, BUTTON_Y, "Sort By Name", Color.blue, 95) { public void execute() { vassalList.sort(new SortByName()); vassalList.refresh(); } }; buttons = new Button[3]; buttons[0] = ok; buttons[1] = nameSort; buttons[2] = classSort; addEntity(cursor); addEntity(ok); addEntity(classSort); addEntity(nameSort); Collections.shuffle(vassals); Collections.shuffle(lords); for(int i = 0; i < maxUnits-1; i++){ selectUnit(vassals.get(i)); } selectUnit(lords.get(0)); refresh(); }