@Override public void render(GUIContext container, Graphics g) throws SlickException { g.setClip((int) x, (int) y, width, height); // background g.setColor(COLOR_BG); g.fillRect(x, y, width, height); // render states if (!stateChangeProgress.isFinished()) { // blend states float t = stateChangeProgress.getValue(); if (state == State.CREATE_USER) t = 1f - t; renderUserSelect(g, t); renderUserCreate(g, 1f - t); } else if (state == State.USER_SELECT) renderUserSelect(g, globalAlpha); else if (state == State.CREATE_USER) renderUserCreate(g, globalAlpha); g.clearClip(); }
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState, int x, int y, String text, Font font, Color textColor, Color boxFillColor, Color boxBorderColor, int padding, int alignX, int alignY){ super(container, x, y); this.text = text; this.font = font; this.textColor = textColor; this.boxFillColor = boxFillColor; this.boxBorderColor = boxBorderColor; borderPadding = padding; this.alignX = alignX; this.alignY = alignY; this.parent = parent; this.onState = onState; }
@Override public void render(GUIContext container, Graphics g) throws SlickException { //Render container g.fill(contents, sf); //Render buttons speedUp.render(container, g); speedDown.render(container, g); pause.render(container, g); restart.render(container, g); euler.render(container, g); hemisphere.render(container, g); close.render(container, g); }
public TSFocusButton(GUIContext container, TSMouseFocusable parent, int x1, int y1, int x2, int y2, Color boxFillColor, Color boxBorderColor){ super(container, x1, y1, x2, y2); this.boxFillColor = boxFillColor; this.boxBorderColor = boxBorderColor; this.parent = parent; }
public TSBoxLabel(GUIContext container, TSComponent item, Color boxFillColor, Color boxBorderColor, int borderPadding){ super(container, 0, 0, 0, 0, item); this.borderPadding = borderPadding; this.boxFillColor = boxFillColor; this.boxBorderColor = boxBorderColor; }
public TSTextLabel(GUIContext container, int x, int y, String text, Font font, Color textColor, int alignX, int alignY){ super(container, x, y, 0, 0); this.text = text; this.font = font; this.textColor = textColor; this.alignX = alignX; this.alignY = alignY; }
public TSFocusTextButton(GUIContext container, TSMouseFocusable parent, int x, int y, String text, Font font, Color textColor, Color boxFillColor, Color boxBorderColor, int padding, int alignX, int alignY){ super(container, parent, x, y, 0, 0, boxFillColor, boxBorderColor); this.text = text; this.font = font; this.textColor = textColor; borderPadding = padding; this.alignX = alignX; this.alignY = alignY; }
public NPCGui(GUIContext c, int x, int y) { this.x = x; this.y = y; this.c = c; background = RessourceManager.loadImage("npcgui.png"); scrollbox = new InventoryScrollBoxComponent(c, RessourceManager.loadImage("scrollbox1.png"), x+16, y+160); }
@Override public void render(GUIContext c, Graphics g) { if (elements == null) return; /* Hintergrund rendern */ super.render(c, g); /* Strings werden gezeichnet */ for (int i=0; i<elements.size();i++) { // textoffset und position (i) verschiebt nach unten (positiv), offset nach oben (negativ) int tempOffsetY = textoffsetY - offset + i*16; int tempOffsetX = textoffsetX; int tempX = getX() + tempOffsetX; int tempY = getY() + tempOffsetY; /* Ausgew�hltes Element blau hinterlegen */ if (i==selected) { // halb-tranzparentes schwarz g.setColor(new Color(0f,0f,0f,0.5f)); g.fillRect(tempX, tempY , getWidth() - 2*textoffsetX, 16); // wei� g.setColor(new Color(1f,1f,1f,1f)); } /* Auch unten ist die Grenze 1*textoffset weiter oben */ if (tempOffsetY + textoffsetY < getHeight()) { String drawString = elements.get(i).getScreenName(); if (elements.get(i).getQuantity() > 1) drawString += " x" + elements.get(i).getQuantity(); g.drawString(drawString, tempX, tempY); } } // �berlappende Elemente verdecken foreground.draw(getX(), getY()); }
public SlickButton(GUIContext container, Image image, int x, int y, int width, int height, ComponentListener listener) { super(container, image, x, y, width, height, listener); }
@Override public void render(GUIContext gameContainer, Graphics g) { super.render(gameContainer, g); g.setColor(Color.black); g.drawString(text, getX() + 20, getY() + 20); }
@Override public void render(GUIContext container, Graphics g) throws SlickException { // update animation long time = container.getTime(); if (lastUpdateTime > 0) { int delta = (int) (time - lastUpdateTime); expandProgress.update((expanded) ? delta : -delta * 2); } this.lastUpdateTime = time; // get parameters Input input = container.getInput(); int idx = getIndexAt(input.getMouseX(), input.getMouseY()); float t = expandProgress.getValue(); if (expanded) t = AnimationEquation.OUT_CUBIC.calc(t); // background and border Color oldGColor = g.getColor(); float oldLineWidth = g.getLineWidth(); final int cornerRadius = 6; g.setLineWidth(1f); g.setColor((idx == -1) ? highlightColor : backgroundColor); g.fillRoundRect((int) x, (int) y, width, baseHeight, cornerRadius); g.setColor(borderColor); g.drawRoundRect((int) x, (int) y, width, baseHeight, cornerRadius); if (expanded || t >= 0.0001) { float oldBackgroundAlpha = backgroundColor.a; backgroundColor.a *= t; g.setColor(backgroundColor); g.fillRoundRect((int) x, (int) (y + offsetY), width, (height - offsetY) * t, cornerRadius); backgroundColor.a = oldBackgroundAlpha; } if (idx >= 0 && t >= 0.9999) { g.setColor(highlightColor); float yPos = y + offsetY + (offsetY * idx); int yOff = 0, hOff = 0; if (idx == 0 || idx == items.length - 1) { g.fillRoundRect((int) x, (int) yPos, width, offsetY, cornerRadius); if (idx == 0) yOff = cornerRadius; hOff = cornerRadius; } g.fillRect((int) x, (int) (yPos + yOff), width, offsetY - hOff); } g.setColor(oldGColor); g.setLineWidth(oldLineWidth); // text chevronDown.draw(x + width - chevronDown.getWidth() - width * CHEVRON_X, y + (baseHeight - chevronDown.getHeight()) / 2f, chevronDownColor); fontNormal.drawString(x + (width * 0.03f), y + (fontNormal.getPaddingTop() + fontNormal.getPaddingBottom()) / 2f, itemNames[itemIndex], textColor); float oldTextAlpha = textColor.a; textColor.a *= t; if (expanded || t >= 0.0001) { for (int i = 0; i < itemNames.length; i++) { Font f = (i == itemIndex) ? fontSelected : fontNormal; if (i == idx && t >= 0.999) chevronRight.draw(x, y + offsetY + (offsetY * i) + (offsetY - chevronRight.getHeight()) / 2f, chevronRightColor); f.drawString(x + chevronRight.getWidth(), y + offsetY + (offsetY * i * t), itemNames[i], textColor); } } textColor.a = oldTextAlpha; }
public TextButton(GUIContext container, String text, int x, int y, Font font) { this(container, text, x, y, font != null ? font.getWidth(text) : container.getDefaultFont().getWidth(text), font != null ? font .getHeight(text) : container.getDefaultFont().getHeight(text)); this.font = font != null ? font : container.getDefaultFont(); this.mouseOverFont = this.font; }
public TextButton(GUIContext container, String text, int x, int y, int width, int height) { super(container, null, x, y, width, height); this.text = text; }
public TextButton(GUIContext container, String text, int x, int y, Font font, ComponentListener listener) { this(container, text, x, y, font); addListener(listener); }
/** * @see org.newdawn.slick.gui.AbstractComponent#render(org.newdawn.slick.gui.GUIContext, * org.newdawn.slick.Graphics) */ public void render(GUIContext container, Graphics g) { if (font != null) g.setFont(font); g.drawString(text, this.getX(), this.getY()); }
public TSBoxMenu(GUIContext container, Color boxFillColor, Color boxBorderColor){ this(container, 0, 0, boxFillColor, boxBorderColor); }
public TSBoxMenu(GUIContext container, int x, int y, Color boxFillColor, Color boxBorderColor){ this(container, x, y, x, y, boxFillColor, boxBorderColor); }
public TSBoxMenu(GUIContext container, int x1, int y1, int x2, int y2, Color boxFillColor, Color boxBorderColor){ super(container, x1, y1, x2, y2); this.boxFillColor = boxFillColor; this.boxBorderColor = boxBorderColor; }
@Override public void render(GUIContext container, Graphics g) throws SlickException{ render((GameContainer) container, g, 0, 0); }
public TSSingleContainerWindowMenu(GUIContext container, Color boxFillColor, Color boxBorderColor){ this(container, 0, 0, boxFillColor, boxBorderColor); }
public TSSingleContainerWindowMenu(GUIContext container, int x, int y, Color boxFillColor, Color boxBorderColor){ this(container, x, y, boxFillColor, boxBorderColor, null); }
public TSSingleContainerWindowMenu(GUIContext container, int x, int y, Color boxFillColor, Color boxBorderColor, TSComponent component){ super(container, x, y, 0, 0, boxFillColor, boxBorderColor); setComponent(component); }
public TSAbstractMenu(GUIContext container){ this(container, 0, 0); }
public TSAbstractMenu(GUIContext container, int x, int y){ this(container, x, y, x, y); }
public TSAbstractMenu(GUIContext container, int x1, int y1, int x2, int y2){ super(container, x1, y1, x2, y2); focus = false; }
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState, String text){ this(container, parent, onState, 0, 0, text); }
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState, int x, int y, String text){ this(container, parent, onState, x, y, text, Helper.getDefaultFont()); }
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState, int x, int y, String text, Font font){ this(container, parent, onState, x, y, text, font, Color.black, Color.white, Color.black); }
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState, int x, int y, String text, Font font, Color textColor, Color boxFillColor, Color boxBorderColor){ this(container, parent, onState, x, y, text, font, textColor, boxFillColor, boxBorderColor, 2, 0, 0); }
public TSWindowMenu(GUIContext container, Color boxFillColor, Color boxBorderColor){ this(container, 0, 0, boxFillColor, boxBorderColor); }
public TSWindowMenu(GUIContext container, int x, int y, Color boxFillColor, Color boxBorderColor){ this(container, x, y, x, y, boxFillColor, boxBorderColor); }
public TSWindowMenu(GUIContext container, int x1, int y1, int x2, int y2, Color boxFillColor, Color boxBorderColor){ super(container, x1, y1, x2, y2, boxFillColor, boxBorderColor); }
public MultiplayerMenu(GUIContext container, int x1, int y1, int x2, int y2, MultiplayerGameEngine ge){ super(container, x1, y1, x2, y2, new Color(200, 200, 255), Color.black); this.ge = ge; }
public GameOverMenu(GUIContext container, int x1, int y1, int x2, int y2, GameEngine ge){ super(container, x1, y1, x2, y2, new Color(200, 200, 255), Color.black); this.ge = ge; }
public HighScoreMenu(GUIContext container, int x1, int y1, int x2, int y2){ super(container, x1, y1, x2, y2, new Color(200, 200, 255), Color.black); }
public OptionsMenu(GUIContext container, int x1, int y1, int x2, int y2, GameEngine ge){ super(container, x1, y1, x2, y2, new Color(200, 200, 255), Color.black); this.ge = ge; }
public StatsMenu(GUIContext container, int x1, int y1, int x2, int y2, GameEngine ge){ super(container, x1, y1, x2, y2, new Color(200, 200, 255), Color.black); this.ge = ge; }
public TSFocusButton(GUIContext container, TSMouseFocusable parent){ this(container, parent, 0, 0); }
public TSFocusButton(GUIContext container, TSMouseFocusable parent, int x, int y){ this(container, parent, x, y, x, y); }