Пример #1
0
  @Override
  public void render(GameContainer gc, StateBasedGame sb, Graphics g) throws SlickException {
    // Background etc.
    g.setAntiAlias(true);
    g.drawImage(
        background,
        gc.getWidth() / 2 - background.getWidth() / 2,
        gc.getHeight() / 2 - background.getHeight() / 2);
    uniTitle.drawString(
        gc.getWidth() / 2 - uniTitle.getWidth("Highscores") / 2,
        (float) 0,
        "Highscores",
        Color.orange);

    count = 0;

    // Zeichnet die Überschrift
    MenuItem item = levelNames.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    item = playerNames.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    item = times.get(0);
    uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());

    // Von start bis zu end
    for (int i = start; i <= end; i++) {
      // Falls wir am ende der Liste angekommen sind, abbrechen und itemsOnSide setzen
      if (i == levelNames.size()) {
        itemsOnSide = i - start;
        break;
      }
      // Maximale itemsOnSide = 10
      else {
        itemsOnSide = 10;
      }

      // Zeichnen der Highscores
      item = levelNames.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
      item = playerNames.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
      item = times.get(i);
      uniNormal.drawString(item.getPos().x, item.getPos().y, item.getName(), item.getColor());
    }

    g.setColor(Color.green);
    g.draw(selection);

    // aktuelle Seite zeichnen
    String displayside = "Seite " + (side + 1) + " von " + sideCount;
    uniNormal.drawString(
        gc.getWidth() / 2 - uniNormal.getWidth(displayside) / 2,
        gc.getHeight() - uniNormal.getHeight(displayside),
        displayside,
        Color.orange);

    // ESC String
    uniNormal.drawString(
        0, gc.getHeight() - uniNormal.getHeight("ESC = Zurück"), "ESC = Zurück", Color.orange);
  }
Пример #2
0
 public void renderStringWithShadow(
     float paramXpos, float paramYpos, String paramStringToRender, Color paramColor) {
   GL11.glPushMatrix();
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
   GL11.glTranslatef(paramXpos, paramYpos, 0);
   unicodeFont.drawString(1, -1, paramStringToRender, Color.black);
   unicodeFont.drawString(0, 0, paramStringToRender, paramColor);
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glPopMatrix();
 }
Пример #3
0
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    nameInput.render(container, g);
    float w = font.getWidth(text);
    float h = font.getLineHeight();
    font.drawString(container.getWidth() / 2 - w / 2, container.getHeight() / 2 - h / 2, text);

    UnicodeFont namefont = Database.instance().getDefaultFont();
    namefont.drawString(
        container.getWidth() / 8, container.getHeight() / 2 - h / 2 + font.getLineHeight(), name);
    nameInput.setLocation(
        container.getWidth() / 8 + namefont.getWidth(name) + 20,
        (int) (container.getHeight() / 2 - h / 2 + font.getLineHeight()));

    nameInput.render(container, g);
  }
Пример #4
0
  public void render() {
    glPushMatrix();
    glLoadIdentity();
    glOrtho(0, Juego.obtenerAnchura(), Juego.obtenerAltura(), 0, 1, -1);
    uFont.drawString(x, y, texto);

    glLoadIdentity();
    glOrtho(0, Juego.obtenerAnchura(), 0, Juego.obtenerAltura(), 1, -1);
    glPopMatrix();
  }
Пример #5
0
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

    bg.draw(0, 0);
    espace.draw(60, 500);
    rubis.draw(230, 120);
    saphirs.draw(200, 200);
    score.draw(230, 0);
    timing.draw(175, 300);
    point.draw(380, 400);
    int Nb_rubis = Item.getNB_Rubis();
    int Nb_saphirs = Item.getNB_Saphir();
    int time = Event.time * 60;
    int score =
        (int) (3000 * Math.exp(-0.00075 * (time - 15 * 60)) + 50 * Nb_rubis + 20 * Nb_saphirs);
    uFont.drawString(400, 130, "" + Nb_rubis);
    uFont.drawString(400, 210, "" + Nb_saphirs);
    uFont.drawString(350, 310, "" + time / 60);
    uFont.drawString(250, 420, "" + score);
  }
Пример #6
0
  public void render() {

    if (selected) {

      glColor4f(0.3f, 0.3f, 0.3f, 0.6f);

      if (isMouseOver()) glColor4f(0.4f, 0.4f, 0.4f, 0.6f);

      renderQuad(x + 1, y + 1, width, height);
      glColor4f(0.1f, 0.1f, 0.1f, 0.8f);
    } else {
      glColor4f(0.1f, 0.1f, 0.1f, 0.8f);

      if (isMouseOver()) glColor4f(0.2f, 0.2f, 0.2f, 0.8f);

      renderQuad(x + 1, y + 1, width, height);
    }

    font.drawString(x + 10, y + 2, text, Color.white);
    glDisable(GL_TEXTURE_2D);
  }
Пример #7
0
 public static void drawString(
     UnicodeFont font, float x, float y, String drawString, Color color) {
   font.drawString(x, y, drawString, color);
 }
Пример #8
0
 public static void drawString(UnicodeFont font, float x, float y, String drawString) {
   font.drawString(x, y, drawString);
 }