Beispiel #1
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    g.drawImage(background, 0, 0);

    g.setFont(menüSchriftStart); // render in mouseoverarea möglich!!!
    g.drawString("START", xtitle1, ytitle1);
    g.setFont(menüSchriftOptionen);
    g.drawString("OPTIONEN", xtitle2, ytitle2);
    g.setFont(menüSchriftCredits);
    g.drawString("CREDITS", xtitle3, ytitle3);
  }
Beispiel #2
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   super.render(gc, sbg, g);
   g.setFont(f1);
   g.drawString("Player Name", 240, 75);
   g.drawString("Opponent Name", 240, 135);
   g.setFont(f2);
   g.drawString(" " + playerOne, 240, 110);
   g.drawString(" " + playerTwo, 240, 160);
   for (int x = 0; x < 12; x++) g.drawString(alphabet[x] + "", 240 + (20 * x), 190);
   for (int x = 12; x < 24; x++) g.drawString(alphabet[x] + "", 240 + (20 * (x - 12)), 210);
   for (int x = 24; x < 26; x++) g.drawString(alphabet[x] + "", 240 + (20 * (x - 24)), 230);
 }
Beispiel #3
0
  /** @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);
  }
Beispiel #4
0
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    g.setBackground(Color.black);
    g.setFont(
        new TrueTypeFont(
            new java.awt.Font(java.awt.Font.SANS_SERIF, java.awt.Font.BOLD, 50), true));

    for (int i = 0; i < 4; ++i) {
      if (i == this.selected) {
        g.setColor(new Color(255, 255, 255));
      } else {
        g.setColor(new Color(0, 0, 255));
      }
      g.fillRect(10, 10 * (i + 1) + 137 * i, 780, 137);
    }

    g.setColor(new Color(255, 255, 255));
    g.drawString("Block Dutz", 250, 50);

    String[] texte = {"Jouer", "Scores", "Quitter"};
    for (int i = 1; i < 4; ++i) {
      if (i == this.selected) {
        g.setColor(new Color(0, 0, 0));
      } else {
        g.setColor(new Color(255, 255, 255));
      }
      g.drawString(texte[i - 1], 300, 10 * (i + 1) + 137 * i + 30);
    }
  }
Beispiel #5
0
 /**
  * Draw a line of text at a given start point
  *
  * @param g - Graphics context
  * @param font - The font of the text
  * @param string - The string to be drawn
  * @param firstLineX - The x coordinate of the first character
  * @param firstLineY - The y coordinate
  */
 public static void drawLines(
     Graphics g, Font font, String string, int firstLineX, int firstLineY) {
   g.setFont(font);
   for (String s : string.split("\n")) {
     g.drawString(s, firstLineX, firstLineY);
     firstLineY += font.getLineHeight() + 10;
   }
 }
Beispiel #6
0
 /**
  * Draws a string centered relative to a given point
  *
  * @param g - Graphics context
  * @param font - The font for the text
  * @param string - the string to draw
  * @param firstLineMiddleX - The middle x coordinate
  * @param firstLineY - The y coordinate
  */
 public static void drawCenteredLines(
     Graphics g, Font font, String string, int firstLineMiddleX, int firstLineY) {
   g.setFont(font);
   for (String s : string.split("\n")) {
     g.drawString(s, firstLineMiddleX - font.getWidth(s) / 2, firstLineY);
     firstLineY += font.getLineHeight() + 10;
   }
 }
 private void renderKioskWarning(Graphics g) {
   g.setColor(Color.white);
   g.setFont(GameFont.GARAMOND_18_WHITE_BOLD.font());
   g.drawString(
       String.format(
           "Returning to main menu in %d seconds. Move mouse to cancel.", getSecondsRemaining()),
       300,
       750);
 }
Beispiel #8
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   world.render(g);
   if (world.isGameOver()) {
     g.setColor(Color.black);
     g.setFont(font);
     int gameOverWidth = font.getWidth("G A M E  O V E R");
     g.drawString("G A M E  O V E R", (ShootingGame.WIDTH - gameOverWidth) / 2, 150);
   }
 }
Beispiel #9
0
  @Override
  public void render(Graphics g) {

    if (isVisible) {
      g.setColor(colorB);
      g.fillRect(0, 0, widht, height);
      g.setColor(colorF);
      g.setFont(font);
      g.drawString(pause, x, y);
    }
  }
  // zeichnen
  public void render(GameContainer container, StateBasedGame sbg, Graphics g)
      throws SlickException {
    hintergrund.draw(0, 0);

    g.setFont(font);

    // auswaelen der States
    for (int a = 0; a < 4; a++) {
      g.setColor(Color.white);

      if (a == wahl) {
        g.setColor(Color.orange);
      }
      g.drawString(auswahl[a], 350, 230 + (a * 65));
    }
  }
  public static void render(GameContainer gc, StateBasedGame sbg, Graphics g) {
    if (showHint) {
      TrueTypeFont currentFont = LDSRacing.font;

      int x = gc.getInput().getMouseX();
      int y = gc.getInput().getMouseY();
      int width = currentFont.getWidth(hint);
      int height = currentFont.getHeight();

      g.setFont(currentFont);
      g.setColor(new Color(255, 255, 255, 255));
      g.fillRect(x - 5, y - height - 10, width + 10, height + 10);
      g.setColor(new Color(0, 0, 0, 255));
      g.drawString(hint, x, y - height - 5);
    }
  }
Beispiel #12
0
 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);
   }
 }
Beispiel #13
0
  /**
   * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, StateBasedGame game, Graphics g) {
    // Hintergrund rendern
    background.draw(0, 0);

    g.setFont(font);
    g.setColor(Color.white);

    g.drawString("GAME PAUSED", container.getWidth() / 2 - (font.getWidth("GAME PAUSED") / 2), 180);

    for (int i = 0; i < options.length; i++) {
      g.setColor(Color.white);
      if (selected == i) {
        g.setColor(Color.red);
        // g.drawRect(200, 390 + (i * 50), 400, 50);
      }
      g.drawString(options[i], 400 - (font.getWidth(options[i]) / 2), 230 + (i * 50));
    }
  }
  @Override
  public void render(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {
    g.drawImage(background, 0, 0, 0, 0, PlatformerGame.WIDTH, PlatformerGame.HEIGHT);
    g.setFont(font);
    g.drawString("CREDITS", 50, 75);
    g.drawString("Music:", 50, 125);
    g.drawString("Cake Town: Matthew Pablo", 50, 150);
    g.drawString("Almost Out: HorrorPen", 50, 175);
    g.drawString("Sound effects: Even Martinez and Zachary Segal", 50, 200);
    g.drawString(
        "       sound effects from fressound.org, by CGEffex, Sagetyrtle, Patchen, Buzzbox\n"
            + "       Plingativator, Streety, Denis Chapon, Setuniman, Morgantj",
        50,
        220);
    g.drawString("Lead Programmers: Predrag Gruevski, David Xiao and Patrick Hulin", 50, 265);
    g.drawString("Level Design: Kevin Yue, Eli Davis, and Ziad Baaklini", 50, 290);
    g.drawString("Art Assets: Turner Bohlen and Zachary Segal", 50, 315);
    g.drawString(
        "*Special thanks to Chris Dessonville for his work on the original prototype*", 50, 340);

    g.draw(MenuButton = new Rectangle(48, 383, 100, 48));
    g.drawString("Back", 50, 385);
  }
Beispiel #15
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   g.setFont(TPP.font);
   g.setColor(Color.red);
   g.drawString("Loading Now" + dots, gc.getWidth() / 3, gc.getHeight() / 30 * 12);
 }
Beispiel #16
0
  @Override
  public void render(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {
    int width = container.getWidth();
    int height = container.getHeight();

    // draw background
    Beatmap beatmap = MusicController.getBeatmap();
    if (Options.isDynamicBackgroundEnabled()
        && beatmap != null
        && beatmap.drawBG(width, height, bgAlpha, true)) ;
    else {
      Image bg = GameImage.MENU_BG.getImage();
      bg.setAlpha(bgAlpha);
      bg.draw();
    }

    // top/bottom horizontal bars
    float oldAlpha = Utils.COLOR_BLACK_ALPHA.a;
    Utils.COLOR_BLACK_ALPHA.a = 0.2f;
    g.setColor(Utils.COLOR_BLACK_ALPHA);
    g.fillRect(0, 0, width, height / 9f);
    g.fillRect(0, height * 8 / 9f, width, height / 9f);
    Utils.COLOR_BLACK_ALPHA.a = oldAlpha;

    // draw downloads button
    downloadsButton.draw();

    // draw buttons
    if (logoTimer > 0) {
      playButton.draw();
      exitButton.draw();
      optionsButton.draw();
    }
    logo.draw();

    // draw music buttons
    if (MusicController.isPlaying()) musicPause.draw();
    else musicPlay.draw();
    musicNext.draw();
    musicPrevious.draw();

    // draw music position bar
    int mouseX = input.getMouseX(), mouseY = input.getMouseY();
    g.setColor((musicPositionBarContains(mouseX, mouseY)) ? BG_HOVER : BG_NORMAL);
    g.fillRoundRect(musicBarX, musicBarY, musicBarWidth, musicBarHeight, 4);
    g.setColor(Color.white);
    if (!MusicController.isTrackLoading() && beatmap != null) {
      float musicBarPosition =
          Math.min((float) MusicController.getPosition() / MusicController.getDuration(), 1f);
      g.fillRoundRect(musicBarX, musicBarY, musicBarWidth * musicBarPosition, musicBarHeight, 4);
    }

    // draw repository button
    if (repoButton != null) repoButton.draw();

    // draw update button
    if (Updater.get().showButton()) {
      Color updateColor = null;
      switch (Updater.get().getStatus()) {
        case UPDATE_AVAILABLE:
          updateColor = Color.red;
          break;
        case UPDATE_DOWNLOADED:
          updateColor = Color.green;
          break;
        case UPDATE_DOWNLOADING:
          updateColor = Color.yellow;
          break;
        default:
          updateColor = Color.white;
          break;
      }
      updateButton.draw(updateColor);
    }

    // draw text
    float marginX = width * 0.015f, topMarginY = height * 0.01f, bottomMarginY = height * 0.015f;
    g.setFont(Utils.FONT_MEDIUM);
    float lineHeight = Utils.FONT_MEDIUM.getLineHeight() * 0.925f;
    g.drawString(
        String.format(
            "Loaded %d songs and %d beatmaps.",
            BeatmapSetList.get().getMapSetCount(), BeatmapSetList.get().getMapCount()),
        marginX,
        topMarginY);
    if (MusicController.isTrackLoading())
      g.drawString("Track loading...", marginX, topMarginY + lineHeight);
    else if (MusicController.trackExists()) {
      if (Options.useUnicodeMetadata()) // load glyphs
      Utils.loadGlyphs(Utils.FONT_MEDIUM, beatmap.titleUnicode, beatmap.artistUnicode);
      g.drawString(
          (MusicController.isPlaying()) ? "Now Playing:" : "Paused:",
          marginX,
          topMarginY + lineHeight);
      g.drawString(
          String.format("%s: %s", beatmap.getArtist(), beatmap.getTitle()),
          marginX + 25,
          topMarginY + (lineHeight * 2));
    }
    g.drawString(
        String.format(
            "opsu! has been running for %s.",
            Utils.getTimeString((int) (System.currentTimeMillis() - programStartTime) / 1000)),
        marginX,
        height - bottomMarginY - (lineHeight * 2));
    g.drawString(
        String.format("It is currently %s.", new SimpleDateFormat("h:mm a").format(new Date())),
        marginX,
        height - bottomMarginY - lineHeight);

    UI.draw(g);
  }
Beispiel #17
0
 @Override
 public void render(Graphics g) {
   g.setFont(this.getFont());
   g.setColor(this.getColor());
   g.drawString(this.getText(), this.rectangle.getX(), this.rectangle.getY());
 }
Beispiel #18
0
 private void renderTitle(Graphics g) {
   g.setColor(Color.white);
   g.setFont(titleFont);
   g.drawString(title, rectangle.getX() + 5, rectangle.getY() + 7);
   g.setFont(HUD.NORMAL_FONT);
 }
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    if (!end) {
      g.drawImage(background, 0, 0);
      g.drawImage(currentItem.getItemImage(), 75, fixed_y + 25);
      g.setFont(titleFont.get());
      g.drawString("> " + start_message + "" + ticker, header_x, header_y);
      g.drawImage(scorebackground, 0, 0);
      g.setFont(mainFont.get());
      g.drawString("" + winString, header_x, header_y + 30);
      g.drawImage(player1.getPlayerCharacter().getCharacterImage(), 13, 13);
      g.drawImage(player2.getPlayerCharacter().getCharacterImage(), 13, 55);
      g.drawString("" + player1.getName(), 65, 22);
      g.drawString("" + player2.getName(), 65, 64);
      g.drawString("" + player1.getScore(), 204, 22);
      g.drawString("" + player2.getScore(), 204, 64);

      g.setFont(timerFont.get());
      if (timer < 100) g.drawString("TIME: 0" + timer, timer_x, timer_y);
      else if (timer < 10) g.drawString("TIME: 00" + timer, timer_x, timer_y);
      else g.drawString("TIME: " + timer, timer_x, timer_y);
      g.setFont(timerMFont.get());
      if (timer2 < 100) g.drawString("0" + timer2, timer_x + 145, timer_y - 10);
      else if (timer2 < 10) g.drawString("00" + timer2, timer_x + 145, timer_y - 10);
      else g.drawString("" + timer2, timer_x + 145, timer_y - 10);

      g.setFont(readyFont.get());
      if (ready) {
        if (playerID == 1) g.drawString("FINISHED", 92, 19);
        else g.drawString("FINISHED", 92, 61);
      }
      if (otherPlayerReady == 1) {
        if (otherPlayerID == 1) g.drawString("FINISHED", 92, 19);
        else g.drawString("FINISHED", 92, 61);
      }
    } else if (end) {
      g.drawImage(background, 0, 0);
      g.setFont(titleFont.get());
      g.drawString("> " + start_message + "" + ticker, header_x, header_y);
      g.setFont(mainFont.get());
      g.drawString("" + winString, header_x, header_y + 30);
      g.drawImage(currentItem.getItemImage(), 75, fixed_y + 25);
      g.drawImage(scorebackground, 0, 0);
      g.setFont(mainFont.get());
      g.drawImage(player1.getPlayerCharacter().getCharacterImage(), 13, 13);
      g.drawImage(player2.getPlayerCharacter().getCharacterImage(), 13, 55);
      g.drawString("" + player1.getName(), 65, 22);
      g.drawString("" + player2.getName(), 65, 64);
      g.drawString("" + player1.getScore(), 204, 22);
      g.drawString("" + player2.getScore(), 204, 64);
      g.setFont(readyFont.get());
      if (ready) {
        if (playerID == 1) g.drawString("FINISHED", 92, 19);
        else g.drawString("FINISHED", 92, 61);
      }
      if (otherPlayerReady == 1) {
        if (otherPlayerID == 1) g.drawString("FINISHED", 92, 19);
        else g.drawString("FINISHED", 92, 61);
      }
      g.setFont(timerFont.get());
      if (timer < 100) g.drawString("TIME: 0" + timer, timer_x, timer_y);
      else if (timer < 10) g.drawString("TIME: 00" + timer, timer_x, timer_y);
      else g.drawString("TIME: " + timer, timer_x, timer_y);
      g.setFont(timerMFont.get());
      if (timer2 < 100) g.drawString("0" + timer2, timer_x + 145, timer_y - 10);
      else if (timer2 < 10) g.drawString("00" + timer2, timer_x + 145, timer_y - 10);
      else g.drawString("" + timer2, timer_x + 145, timer_y - 10);

      if (finished) {
        g.drawImage(background, 0, 0);
        g.setFont(titleFont.get());
        g.drawString("> " + start_message + "" + ticker, 25, 25);
        g.drawString("" + timer, 750, 50);
        g.drawImage(currentItem.getItemImage(), 75, 125);
        g.drawImage(new Image("simple/playerbg.png"), 146, 435);
        g.drawImage(new Image("simple/playerbg.png"), 506, 435);
        g.drawImage(player1.getPlayerCharacter().getCharacterImage(), 146, 435);
        g.drawImage(player2.getPlayerCharacter().getCharacterImage(), 506, 435);
        g.setFont(mainFont.get());
        g.drawString(winString, 50, 60);
        g.drawString("" + player1.getName(), 198, 444);
        g.drawString("" + player2.getName(), 558, 444);
      }
    }
  }
Beispiel #20
0
  @Override
  public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics)
      throws SlickException {
    background.draw(0, 0);
    tandwiel1.draw(
        -tandwiel1.getWidth() / 2,
        AsaGame.SOURCE_RESOLUTION.height / 2 - tandwiel1.getHeight() / 2);
    tandwiel2.draw(
        tandwiel1.getWidth() / 2 - tandwielOffset - 40,
        AsaGame.SOURCE_RESOLUTION.height / 2 - tandwiel2.getHeight());

    graphics.setFont(fontBlack);

    if (baseImage != null) {
      webcamFeed
          .getSubImage(80, 0, 480, 480)
          .draw(center.getWidth() - ((500) / 2), center.getHeight() - (500 / 2), 500, 500);
      background_spinner_half.draw(
          center.getWidth() - background_spinner.getWidth() / 2, center.getHeight() + 45);
    } else {
      background_spinner.draw(
          center.getWidth() - background_spinner.getWidth() / 2,
          center.getHeight() - background_spinner.getHeight() / 2);
    }

    if (mode == 1) {
      spinner.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      spinneroverlay.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      selectImage.draw(center.getWidth() / 2 - 20, 60);
      choise.draw(
          choise.getWidth() * 0.15f,
          center.getHeight() * 2 - choise.getHeight() * 1.6f,
          pulseScale);
      for (int i = 0; i < wheelOptions.size(); i++) {
        float offsetDegree = 360 / wheelOptions.size();
        float degrees = (270 + ((rotation + rotationDelta) % 360 + offsetDegree * i) % 360) % 360;
        if (degrees < 0) {
          degrees = degrees + 360;
        }
        float rad = (float) (degrees * (Math.PI / 180));
        float radius = 313;

        float x = (float) (center.getWidth() + radius * Math.cos(rad));
        float y = (float) (center.getHeight() + radius * Math.sin(rad));

        WheelOptionYesNo option = wheelOptions.get(i);
        Image optionIcon = option.getIcon();

        float biggerThanDegrees = 270 + (offsetDegree / 2);
        if (biggerThanDegrees > 360) {
          biggerThanDegrees = biggerThanDegrees - 360;
        }

        if (degrees >= 270 - (offsetDegree / 2) && degrees < biggerThanDegrees) {
          x = x - (float) (optionIcon.getWidth() * 1.3 / 2);
          y = y - (float) (optionIcon.getHeight() * 1.3 / 2);
          option.getIcon().draw(x, y, (float) 1.3);
        } else {
          x = x - (float) (optionIcon.getWidth() * 1 / 2);
          y = y - (float) (optionIcon.getHeight() * 1 / 2);
          option.getIcon().draw(x, y);
        }

        if (degrees >= 270 - (offsetDegree / 2) && degrees < biggerThanDegrees) {
          selectedOption = i;
        }
      }
    } else {
      lens.draw(center.getWidth() - (550 / 2), center.getHeight() - (550 / 2));
      spinner.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      spinneroverlay.draw(
          center.getWidth() - spinner.getWidth() / 2, center.getHeight() - spinner.getHeight() / 2);
      if (drawCountdown) {
        countdown.draw(center.getWidth() - 75, center.getHeight() + 75, 150, 150);
      }
    }
  }
  @Override
  public void doRender(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {

    g.setFont(GameController.GAME_FONT);

    // grab the player
    Player player = GameController.instance().getPlayer();
    int maxFloors = GameController.instance().getMaxFloors();

    float y = getTopY() + 10;

    g.setColor(Color.blue);
    centeredText("Your hero has been created!", g, y);
    y += 30;

    g.setColor(Color.darkGray);
    leftAlignedText("Your starting attributes:", g, y);
    y += 20;

    // list the current attributes from the hero
    List<Attribute> attributes = GameController.instance().getPlayer().getAttributes();

    for (Attribute attr : attributes) {
      float x = getLeftX() + 5;
      String attrName = attr.getName();
      int width = g.getFont().getWidth(attrName);
      g.setColor(Color.blue);
      g.drawString(attrName, x, y);
      g.setColor(Color.gray);
      g.drawString("(" + attr.getShortDesc() + ")", x + width + 4, y);
      y += 20;
    }

    y += 10;

    // list the starting weapon
    Weapon w = player.getEquippedWeapon();
    Ammo a = player.getAmmoFor(w);

    g.setColor(Color.darkGray);
    leftAlignedText("Starting weapon:", g, y);
    y += 20;
    g.setColor(Color.blue);
    if (w != null) {
      String text = w.getName();
      if (a != null) {
        text += "(" + a.getQuantity() + " ammo)";
      }
      leftAlignedText(text, g, y);
    } else {
      leftAlignedText("None", g, y);
    }

    y += 30;
    Bandage b = (Bandage) player.getItemByName(Bandage.ITEM_NAME);
    leftAlignedText(b.getQuantity() + " bandages", g, y);

    g.setColor(Color.blue);
    y = getBottomY() - 30;
    centeredText("Press any key to start", g, y);
  }