예제 #1
0
 private void printText() {
   laranjaEscuro = new Color(214, 95, 0);
   imgHelp.setColor(laranjaEscuro);
   Font play = new Font("sanserif", Font.BOLD, 30);
   imgHelp.setFont(play);
   int x = imgHelp.getWidth() - 130;
   int y = imgHelp.getHeight() - 16;
   imgHelp.drawString("Help", x, y);
 }
예제 #2
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));
   }
 }
예제 #3
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);
  }
예제 #4
0
  public AnswerMedium(String txt) {

    ansmed = txt;

    // First we create an image that will hold our largest answer, so that we can
    // align all the text to the left.
    GreenfootImage imgTxt = new GreenfootImage(300, 30);
    // if we include "java.awt." in the next line, we don't have to import the class
    // See http://www.greenfoot.org/topics/187
    imgTxt.setColor(java.awt.Color.black);

    imgTxt.setFont(new java.awt.Font("Helvetica", java.awt.Font.PLAIN, 14));
    imgTxt.drawString(ansmed, 1, 15);

    // TextImage t=new TextImage(ans);
    setImage(imgTxt);
  }