예제 #1
0
 /**
  * Add the scores for the individual maps to the score board. 'scores' is an array with all
  * scores, 'mapNo' is the number of the current map (array entries past this value have no valid
  * value).
  */
 private void addMapScores(int mapNo, int[] scores) {
   GreenfootImage image = getImage();
   Font font = image.getFont();
   font = font.deriveFont(20.0f);
   image.setFont(font);
   image.setColor(Color.WHITE);
   for (int i = 0; i <= mapNo; i++) {
     image.drawString("Map " + (i + 1) + ": " + scores[i], 460, 80 + (i * 28));
   }
 }
예제 #2
0
  /** Make the score board image. */
  private void makeImage(String title, String text, String prefix, int score) {
    GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT);

    image.setColor(new Color(0, 0, 0, 128));
    image.fillRect(0, 0, WIDTH, HEIGHT);
    image.setColor(new Color(0, 0, 0, 128));
    image.fillRect(5, 5, WIDTH - 10, HEIGHT - 10);
    Font font = image.getFont();
    font = font.deriveFont(FONT_SIZE);
    image.setFont(font);
    image.setColor(Color.WHITE);
    image.drawString(title, 60, 100);
    image.drawString(text, 60, 220);
    image.drawString(prefix + score, 60, 320);
    setImage(image);
  }