package eu.midnightdust.yaytris.ui;

import javax.swing.*;

import static eu.midnightdust.yaytris.Translation.t;

public class MainMenu extends AbstractMenu {
    final TetrisUI ui;

    MainMenu(int x, int y, int width, int height, TetrisUI ui) {
        this.ui = ui;
        this.setBounds(x, y, width, height);
        this.setLayout(null);

        JButton startButton = new JButton(t("menu.start"));
        startButton.addActionListener(ui::startGame);
        this.add(startButton);

        JButton settingsButton = new JButton(t("menu.settings"));
        settingsButton.addActionListener(ui::openSettings);
        this.add(settingsButton);

        JButton highscoreButton = new JButton(t("menu.highscores"));
        highscoreButton.addActionListener(ui::openHighscores);
        this.add(highscoreButton);

        JButton leaveButton = new JButton(t("menu.exit"));
        leaveButton.addActionListener(e -> System.exit(0));
        this.add(leaveButton);
    }
}
