Пример #1
0
 @Override
 public void render(GameContainer gc, Graphics g) {
   // Fond d'ecran plus sombre
   g.setColor(new Color(0.0f, 0.0f, 0.0f, backgroundTransparency));
   g.fillRect(0, 0, Global.WINDOW_WIDTH, Global.WINDOW_HEIGHT);
   // Menu
   this.menuBackgroundImage.draw(DEATH_X, DEATH_Y, DEATH_W, DEATH_H);
   g.setColor(new Color(0.0f, 0.0f, 0.0f, menuBackgroundTransparency));
   g.fillRect(DEATH_X, DEATH_Y, DEATH_W, DEATH_H);
   // Boutons
   display.render(gc, g);
 }
Пример #2
0
  @Override
  public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    g.setColor(Color.black);

    // Top part
    backgroundImage.draw(
        -backgroundImage.getWidth() / 8, -backgroundImage.getHeight() / 8, 300, 800);
    titleImage.draw(TITLE_X, TITLE_Y);
    newGameImage.draw(NEWGAME_X, NEWGAME_Y);
    loadGameImage.draw(LOADGAME_X, LOADGAME_Y);
    if (MainMenuGameState.optionsActivated) {
      optionsImage.draw(OPTIONS_X, OPTIONS_Y);
    }

    // Map part
    mapImage.draw(MAP_X, MAP_Y, 800 - 2 * MAP_X, 600 - MAP_Y);
    Save s = Save.getInstance();
    if (s.hasSaveLoaded()) {
      int[] ids = s.getAllIds();
      for (int i = 0; i < ids.length; i++) {
        int[] mapLvl = s.mapPointForLevelID(ids[i]);
        if (mapLvl != null) {
          switch (s.getFinishedStateForLevelID(ids[i])) {
            case 0:
              mapLvlDefaultImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 1:
              mapLvlUnlockedImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 2:
              mapLvlFinishedImage.draw(MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            case 3:
              mapLvlUnlockedFinishedImage.draw(
                  MAP_X + mapLvl[0], MAP_Y + mapLvl[1], mapLvl[2], mapLvl[3]);
              break;
            default:
              break;
          }
        }
      }
    }

    display.render(gc, g);
  }