@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); }
public void pinta(Graphics g) { float ancho_anterior = g.getLineWidth(); Color color_anterior = g.getColor(); // ///////////////////////////////// g.setLineWidth(3); this.actualizaAngulo(); g.setColor(new Color(1, 0, 0, 0.2f)); g.fillArc( this.centroX - radio, this.centroY - radio, radio * 2, radio * 2, 270, this.angulo - 90); g.setAntiAlias(true); g.setColor(this.color_reloj); g.drawOval(this.centroX - radio, this.centroY - radio, radio * 2, radio * 2); float px = 0, py = 0; px = (float) (this.centroX + radio * 8 / 10 * Math.cos(Math.toRadians(angulo) - Math.PI / 2)); py = (float) (this.centroY + radio * 8 / 10 * Math.sin(Math.toRadians(angulo) - Math.PI / 2)); g.setColor(color_manilla); g.drawLine(centroX, centroY, px, py); g.setAntiAlias(false); // ///////////////////////////////// g.setLineWidth(ancho_anterior); g.setColor(color_anterior); }
public void setAnimState(AnimState state) { if (state != null) resetAnimState(); getPrivates(); stateColor = g.getColor(); stateNew = new AnimState(state); g.setColor(state.color); state.color.bind(); if (state.pos.x != 0 || state.pos.y != 0) g.translate(-state.pos.x, -state.pos.y); if (state.angle != 0) gl.glRotatef(-state.angle, 0f, 0f, 1f); if (state.scaleH != 1 || state.scaleV != 1) g.scale(1f / state.scaleH, 1f / state.scaleV); }
/** @see AbstractComponent#render(GUIContext, org.newdawn.slick.Graphics) */ public void render(GUIContext container, Graphics g) { if (lastKey != -1) { if (input.isKeyDown(lastKey)) { if (repeatTimer < System.currentTimeMillis()) { repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL; keyPressed(lastKey, lastChar); } } else { lastKey = -1; } } Rectangle oldClip = g.getClip(); g.setWorldClip(x, y, width, height); // Someone could have set a color for me to blend... Color clr = g.getColor(); if (background != null) { g.setColor(background.multiply(clr)); g.fillRect(x, y, width, height); } g.setColor(text.multiply(clr)); Font temp = g.getFont(); int cpos = font.getWidth(value.substring(0, cursorPos)); int tx = 0; if (cpos > width) { tx = width - cpos - font.getWidth("_"); } g.translate(tx + 2, 0); g.setFont(font); g.drawString(value, x + 1, y + 1); if (hasFocus() && visibleCursor) { g.drawString("_", x + 1 + cpos + 2, y + 1); } g.translate(-tx - 2, 0); if (border != null) { g.setColor(border.multiply(clr)); g.drawRect(x, y, width, height); } g.setColor(clr); g.setFont(temp); g.clearWorldClip(); g.setClip(oldClip); }
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); }
@Override public void render(Graphics g2) { if (!worldName.isEmpty()) { createWorldButton.enabled = true; } else { createWorldButton.enabled = false; } org.newdawn.slick.Color temp = g2.getColor(); super.render(g2); // g2.setPaint(p); g2.setColor(org.newdawn.slick.Color.black); FontHandler.resizeFont(g2, 16); FontHandler.changeFontStyle(g2, Font.BOLD); g2.drawString("Enter world name:", renderStart + 5, 100); FontHandler.resetFont(g2); g2.setColor(temp); }
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()); } }
public void drawTriangle(Vector2f p1, Vector2f p2, Vector2f p3) { drawTriangle(p1, p2, p3, g.getColor(), g.getColor(), g.getColor()); }
@Override public void render(Graphics g, Point point) { Color orgColor = g.getColor(); int x = point.x; int y = point.y; g.setColor(Color.white); g.fillRect(x, y, AOGame.WIDTH, 15); g.setColor(Color.gray); g.drawString("System (F1)|", x + 15, y - 3); g.drawString("Character (F2)|", x + 135, y - 3); g.drawString("MENU 1 (F3)|", x + 285, y - 3); g.drawString("MENU 2 (F4)|", x + 405, y - 3); g.drawString("MENU 3 (F5)", x + 525, y - 3); g.setColor(Color.black); Menu m = Menu.valueOf(cursor); switch (menu) { case CM_SYS: g.drawString("System (F1)|", x + 15, y - 3); g.setColor(Color.white); g.fillRect(x, y + 15, 120, 110); g.setColor(Color.gray); g.drawString("Save", x + 38, y + 20); g.drawString("Load", x + 38, y + 50); g.drawString("Settings", x + 20, y + 75); g.drawString("Exit", x + 38, y + 100); g.setColor(Color.black); switch (m) { case SYS_S: g.drawString("Save", x + 38, y + 20); break; case SYS_L: g.drawString("Load", x + 38, y + 50); break; case SYS_O: g.drawString("Settings", x + 20, y + 75); break; case SYS_E: g.drawString("Exit", x + 38, y + 100); break; default: } break; case CM_C: g.drawString("Character (F2)|", x + 135, y - 3); g.setColor(Color.white); g.fillRect(x + 120, y + 15, 147, 160); g.setColor(Color.gray); g.drawString("Character", x + 153, y + 20); g.drawString("Equipment", x + 153, y + 45); g.drawString("Skill tree", x + 148, y + 70); g.drawString("Items", x + 171, y + 95); g.drawString("Quest", x + 171, y + 120); g.drawString("Map", x + 179, y + 145); g.setColor(Color.black); switch (m) { case CHAR_C: g.drawString("Character", x + 153, y + 20); break; case CHAR_E: g.drawString("Equipment", x + 153, y + 45); break; case CHAR_S: g.drawString("Skill tree", x + 148, y + 70); break; case CHAR_I: g.drawString("Items", x + 171, y + 95); break; case CHAR_Q: g.drawString("Quest", x + 171, y + 120); break; case CHAR_M: g.drawString("Map", x + 179, y + 145); break; default: } break; case CM_M1: g.drawString("MENU 1 (F3)|", x + 285, y - 3); break; case CM_M2: g.drawString("MENU 2 (F4)|", x + 405, y - 3); break; case CM_M3: g.drawString("MENU 3 (F5)", x + 525, y - 3); break; default: break; } g.setColor(orgColor); }