コード例 #1
0
ファイル: UIDeath.java プロジェクト: aumeunier/ic06-amscjl
  public UIDeath(GameContainer gc) {
    this.backgroundTransparency = 0.7f;
    this.menuBackgroundTransparency = 0.3f;
    this.display = new Display(gc);

    // Background image
    this.menuBackgroundImage = Global.setImage("1770925_s.jpg");

    // You lost label
    Image gameOverImage =
        Global.setImage("blur11.jpg").getScaledCopy(DEATH_W - 2 * BUTTON_SPACE, BUTTON_H);
    Label gameOver = new Label(gameOverImage, "Vous etes morts!\n");
    gameOver.setBounds(
        BUTTON_X, DEATH_Y + DEATH_H / 3 - BUTTON_H, DEATH_W - 2 * BUTTON_SPACE, BUTTON_H);
    gameOver.setForeground(Color.black);
    gameOver.pack();
    this.display.add(gameOver);
    gameOver.setImage(null);

    // Restart button //TODO: Button
    Image buttonImage = Global.setImage("blur11.jpg").getScaledCopy(BUTTON_W, BUTTON_H);
    Label restartLabel = new Label(buttonImage, "Recommencer");
    restartLabel.setBounds(BUTTON_X, BUTTON_Y, BUTTON_W, BUTTON_H);
    restartLabel.pack();
    this.display.add(restartLabel);

    // Back button //TODO: Button
    Label backToMenuLabel = new Label(buttonImage, "Menu principal");
    backToMenuLabel.setBounds(BUTTON_X + BUTTON_W + BUTTON_SPACE, BUTTON_Y, BUTTON_W, BUTTON_H);
    backToMenuLabel.pack();
    this.display.add(backToMenuLabel);
  }
コード例 #2
0
  @Override
  public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    // Images
    backgroundImage = Global.setImage("papyrus_page.png");
    backgroundImage.rotate(90);
    mapImage = Global.setImage("scroll_background_page_horizontal.png");
    mapLvlDefaultImage = Global.setImage("bloque_niveau.png");
    mapLvlUnlockedImage = Global.setImage("debut_niveau.png");
    mapLvlUnlockedFinishedImage = Global.setImage("fin_niveau.png");
    mapLvlFinishedImage = Global.setImage("fin_niveau.png");

    // Labels
    newGameImage = Global.setImage("main_menu_nouvelle_partie.png");
    newGameImage =
        newGameImage.getScaledCopy(
            (int) (newGameImage.getWidth() * SCALE_DOWN_W), newGameImage.getHeight());

    loadGameImage = Global.setImage("main_menu_charger_partie.png");
    loadGameImage =
        loadGameImage.getScaledCopy(
            (int) (loadGameImage.getWidth() * SCALE_DOWN_W), loadGameImage.getHeight());

    if (optionsActivated) {
      optionsImage = Global.setImage("main_menu_options.png");
      optionsImage =
          optionsImage.getScaledCopy(
              (int) (optionsImage.getWidth() * SCALE_DOWN_W), optionsImage.getHeight());
    }

    titleImage = Global.setImage("main_menu_title.png");
    titleImage =
        titleImage.getScaledCopy(
            (int) (titleImage.getWidth() * SCALE_DOWN_W * 1.5), titleImage.getHeight());

    display = new Display(gc);
    Image labelImage = Global.setImage(Global.BUTTON_STANDARD_IMAGE);
    Image playerImage = labelImage.getScaledCopy(150, 25);
    mapErrorLabel = new Label(playerImage, "");
    mapErrorLabel.setForeground(Color.red);
    mapErrorLabel.setBounds(800 - ERROR_X - ERROR_W, ERROR_Y, ERROR_W, ERROR_H);
    mapErrorLabel.pack();
    this.display.add(mapErrorLabel);
    mapErrorLabel.setImage(null);
  }