Esempio n. 1
0
 public void paintComponent(java.awt.Graphics g) {
   super.paintComponent(g);
   _title.paint((Graphics2D) g, _title.getImage());
   _newGame.paint((Graphics2D) g, _newGame.getImage());
   _continue.paint((Graphics2D) g, _continue.getImage());
   _quit.paint((Graphics2D) g, _quit.getImage());
 }
Esempio n. 2
0
  public MainMenuScreen(DoodleTactics dt) {
    super(dt);

    this.setBackground(java.awt.Color.GRAY);
    BufferedImage titleD = dt.importImage("src/graphics/menu/title.png");
    BufferedImage newGameD = dt.importImage("src/graphics/menu/new_game.png");
    BufferedImage newGameH = dt.importImage("src/graphics/menu/new_game_hovered.png");
    BufferedImage continueD = dt.importImage("src/graphics/menu/continue.png");
    BufferedImage continueH = dt.importImage("src/graphics/menu/continue_hovered.png");
    BufferedImage quitD = dt.importImage("src/graphics/menu/quit.png");
    BufferedImage quitH = dt.importImage("src/graphics/menu/quit_hovered.png");

    _title = new MenuItem(this, titleD, titleD, dt);
    _newGame = new ScreenChangeMenuItem(this, newGameD, newGameH, dt, dt.getGameScreen());

    _continue = new LoadGameMenuItem(this, continueD, continueH, dt);
    _quit = new QuitMenuButton(this, quitD, quitH, dt);
    _title.setLocation(
        ((DoodleTactics.TILE_COLS * map.Tile.TILE_SIZE) - _title.getImage().getWidth()) / 2, 50);
    int offset =
        ((DoodleTactics.TILE_COLS * map.Tile.TILE_SIZE) - _newGame.getImage().getWidth()) / 2;

    _newGame.setLocation(offset, 250);
    _continue.setLocation(offset, 400);
    _quit.setLocation(offset, 550);
    _title.setVisible(true);
    _newGame.setVisible(true);
    _continue.setVisible(true);
    _quit.setVisible(true);
  }