/** * Draws the bar * * @param g - graphics object */ public void draw(Graphics g) { g.setColor(bg); g.fill(body); g.setColor(hl); g.fill(highlight); g.fill( bodyL, new GradientFill( bodyL.getX(), bodyL.getY(), bg, bodyL.getX() + bodyL.getWidth(), bodyL.getY(), Color.transparent)); g.fill( bodyR, new GradientFill( bodyR.getX(), bodyR.getY(), Color.transparent, bodyR.getX() + bodyR.getWidth() + 1, bodyR.getY(), bg)); }
@Override public void render(Graphics g) { g.setColor(colors[pos]); g.fill(shape); g.setColor(Color.white); shownFor++; if (AOE) { if (AOEShape != null) { if (new Random().nextInt(500) != 5) g.setColor(color); g.fill(AOEShape); g.setColor(Color.white); } } }
@Override public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException { int nb = 0; if (server != null) { nb = server.getPartie().size(); g.drawString("Server : ON", 5, 5); } else g.drawString("Server : OFF", 5, 5); g.drawString( "Listes des parties ouvertes : " + nb, shapeListeServers.getX() + shapeListeServers.getWidth() / 2 - container.getDefaultFont().getWidth("Listes des parties ouvertes :" + nb) / 2, shapeListeServers.getY() - container.getDefaultFont().getHeight("Listes des parties ouvertes :" + nb) - 2); g.setDrawMode(Graphics.MODE_COLOR_MULTIPLY); g.setColor(Color.gray); g.fill(shapeListeServers); g.setDrawMode(Graphics.MODE_NORMAL); g.setColor(Color.white); g.draw(shapeListeServers); listeServers.renderString(container, g); butRetour.render(container, g); butCreerServer.render(container, g); super.render(container, game, g); }
@Override public void renderObject(Graphics g2, UIMenu menu) { org.newdawn.slick.Color temp = g2.getColor(); g2.setColor( FontHandler.getColorToSlick( textInput ? new Color(91, 91, 91, 185) : new Color(20, 20, 20, 185))); g2.fill(new Rectangle(x, y, width, height)); g2.setColor(org.newdawn.slick.Color.white); FontHandler.resizeFont(g2, 22); FontHandler.changeFontStyle(g2, Font.BOLD); g2.drawString(worldName, renderStart + 3, y); FontHandler.resetFont(g2); if (textInput) { int xx = renderStart + 3 + (worldName != null ? worldName.length() * 12 : 0); FontHandler.resizeFont(g2, 22); g2.drawString("_", xx, y); FontHandler.resetFont(g2); } g2.setColor(temp); }
@Override public void render(Graphics g) { if (size == 0) { super.render(g); } else { g.fill(new Rectangle(x - size / 2, y - size / 2, size, size)); } }
/** * @see org.newdawn.slick.gui.AbstractComponent#render(org.newdawn.slick.gui.GUIContext, * org.newdawn.slick.Graphics) */ public void render(GUIContext container, Graphics g) { if (currentImage != null) { currentImage.draw(area.getX(), area.getY(), currentColor); } else { g.setColor(currentColor); g.fill(area); } updateImage(); }
public void render(Graphics g, int x, int y, float xCam, float yCam) { this.x = x + (int) xCam; this.y = y + (int) yCam; for (PolygonTuile pt : tuiles) { pt.setLocation(x, y); g.setColor(new Color(0, 200, 0, 75)); g.fill(pt); g.draw(pt); } }
@Override public void render(Graphics g) { // TODO immages and filling in and stuff super.render(g); g.setColor(Color.red); // g.draw(new SHx, y, (float) (width * (healthDisplayed / maxHealth)), height); g.fill(new Rectangle(x, y, (float) ((healthDisplayed / maxHealth) * (double) width), height)); g.setColor(Color.white); g.drawString("" + (int) health, x + width / 2 - 10, y); }
public void render(GameContainer container, Graphics g) { if (display) { Rectangle box = new Rectangle(pos_x, pos_y, BOX_WIDTH, BOX_HEIGHT); g.setColor(Color.black); g.fill(box); g.setColor(Color.white); g.draw(box); String drawtext = currentMessage.getDrawText(typeSound); g.drawString(drawtext, 60, 320); waiting = currentMessage.isWaiting(); } }
/** * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, * org.newdawn.slick.Graphics) */ public void render(GameContainer container, Graphics g) { g.rotate(400, 300, ang); g.fill(rect, gradient); g.fill(round, gradient); g.fill(poly, gradient2); g.fill(center, gradient4); g.setAntiAlias(true); g.setLineWidth(10); g.draw(round2, gradient2); g.setLineWidth(2); g.draw(poly, gradient); g.setAntiAlias(false); g.fill(center, gradient4); g.setAntiAlias(true); g.setColor(Color.black); g.draw(center); g.setAntiAlias(false); }
public void render(GUIContext container, Graphics g) throws SlickException { if (!isVisible()) return; Color old = g.getColor(); if (currentImage != null) { g.texture(area, currentImage, true); } else { g.setColor(currentColor); g.fill(area); } if (text != null) { font.drawString( area.getX() + textWidthPadding, area.getY() + textHeightPadding + textYModifier, text); } updateImage(); g.setColor(old); }
void render(GUIContext container, Graphics g) { g.setColor(Color.gray); g.fill(rectangle); renderTitle(g); if (replacementButton != null) { renderReplacement(container, g); } choiceButtons.render(container, g); choiceButtons.highlight(container, g, highlightedIndex, Color.green); g.setColor(Color.white); g.drawRoundRect( rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight(), 5); g.setFont(HUD.NORMAL_FONT); if (tooltip != null) { tooltip.render(container, g); } }
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) { g.draw(dims); int x1 = (int) dims.getX(); int y1 = (int) dims.getY(); g.setColor(Color.white); g.drawString("Inventory", x1 + dims.getWidth() / 2 - labelOffset, y1); g.setColor(Color.gray); for (int i = 0; i < inventoryBoxes.size(); i++) { ShipPartBox box = inventoryBoxes.get(i); ShipPart tempPart = box.getPart(); Rectangle rect = box.getRectangle(); // Make special if its selected :D if (tempPart.equals(selectedPart)) { g.setColor(new Color(255, 165, 0, 150)); int tempXOffset = (int) (partInterval - rect.getWidth()); int tempYOffset = (int) (partInterval - rect.getHeight()); Rectangle tempRect = new Rectangle(rect.getX() - tempXOffset / 2, rect.getY() - tempYOffset / 2, 50, 50); g.fill(tempRect); } g.drawImage( tempPart.getImage(), rect.getX(), rect.getY(), rect.getX() + rect.getWidth(), rect.getY() + rect.getHeight(), (float) 0, (float) 0, (float) tempPart.getImage().getWidth(), (float) tempPart.getImage().getHeight()); } }
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { g.setBackground(new Color(0, 0, 0)); // setting black background to avoid bugs with other states if (menu[0]) { // When play is true g.drawString("Set the level: " + Game.level, gc.getWidth() / 2 - 80, gc.getHeight() / 2 - 15); g.drawString("Use W or S to change level", gc.getWidth() / 2 - 120, gc.getHeight() / 2 + 15); g.drawString( "Press enter when you have chosen", gc.getWidth() / 2 - 140, gc.getHeight() / 2 + 30); } else if (menu[1]) { // When about is true g.drawImage(about, 40, 300); g.drawString("Your goal is to escape from darkness. Sound and light can help you.", 40, 350); g.drawString( "If you are away from quit the screen is darker. When close the screen is lighter.", 40, 365); g.drawString( "Controls: W,S,A,D to move (1 press = 1 step) and ESC to return to menu", 40, 380); g.drawString( "This game is made for Ludum Dare 26 compo - Theme minimalism. Remember to rate! :)", 40, 425); g.drawString("Press enter to return.", 40, 460); } else { // When nothing from menu is true // Info about screen modes if (gc.isFullscreen()) g.drawString("Press P to disable full screen mode", 40, 738); else g.drawString("Press P to enable full screen mode", 40, 738); g.drawImage(logo, 25, 300); g.drawImage(play, 45, 400); g.drawImage(about, 40, 435); g.drawImage(exit, 45, 470); g.fill(menuPointer); g.draw(menuPointer); } }
@Override public void render(Graphics g) { // TODO Auto-generated method stub g.setColor(this.color); g.fill(this.ball); }
public void render(GUIContext ctx, Graphics g, Component comp, Skin skin, Theme theme) { // makes sure it's the same as what we're attached to checkComponent(comp); CheckBox check = (CheckBox) comp; Rectangle cachedRect = null; boolean roundRectEnabled = SimpleSkin.isRoundRectanglesEnabled(); // make sure we are showing outline // also, the outline will only render if we aren't rendering a background if (isShowOutline() && (!check.isOpaque() || check.getBackground() == null)) { // get the cached rectangle from the component bounds cachedRect = check.getAbsoluteBounds(); Rectangle bounds = cachedRect; // if we have round rectangles, use them if (roundRectEnabled && roundBounds != null) { roundBounds.setBounds(bounds); bounds = roundBounds; } Color oldCol = g.getColor(); boolean oldAA = g.isAntiAlias(); Color back; if (check.getState() != Button.UP) // hover back = theme.getPrimary1(); else // still back = theme.getPrimary3(); g.setColor(back); g.setAntiAlias(true); g.fill(bounds); g.setAntiAlias(oldAA); g.setColor(oldCol); } // renders base SkinUtil.renderComponentBase(g, check); // renders text/image SkinUtil.renderCheckBoxBase(g, check); // get cached bounds from the "check" box button area Rectangle cachedBox = check.getAbsoluteBoxBounds(); Rectangle btnRect = cachedBox; // try to use round rectangle if (roundRectEnabled && roundBoxBounds != null) { roundBoxBounds.setBounds(cachedBox); btnRect = roundBoxBounds; } // renders the actual button state for the small box area, using rounded edges SimpleButtonAppearance.renderButtonState(g, theme, check, btnRect, grad); Image def = getDefaultImage(); if (def != null && check.isSelected()) { float x = btnRect.getX() + (btnRect.getWidth() / 2f - def.getWidth() / 2f); float y = btnRect.getY() + (btnRect.getHeight() / 2f - def.getHeight() / 2f); g.drawImage(def, (int) x, (int) y, check.getImageFilter()); } }
@Override public void render(Graphics g) { g.setColor(Color.white); g.fill(sp); }
public void drawColorRect(Graphics g, int drawX, int drawY) { g.setColor(new Color(colorNameR, colorNameG, colorNameB)); g.fill(new Rectangle(drawX + 16, drawY + 16, 16, 16)); }