MainMenu.pde 1,65 ko
Newer Older
class MainMenu {
    boolean isSettingsClick = false;
    boolean isPlayGame = false;
    boolean isSettings = false;
    boolean isDead = false;
    PFont comic;
    SettingsJSON settings;
    boolean loaded = false;
    void draw() {
Axel PERSEVALLE's avatar
Axel PERSEVALLE a validé
        //if (!loaded) {
            settings = new SettingsJSON();
            settings.loadSettings();
            loaded= true;
Axel PERSEVALLE's avatar
Axel PERSEVALLE a validé
        //}
        isPlayGame = false;
        isSettings = false;
        isDead = false;
        if (settings.darkMode) {
            background(0);
        } else {
            background(255);
        }
        rectMode(CENTER);
        if (settings.darkMode) {
          stroke(255);
            fill(0);
        }
        else{
          stroke(0);
            fill(255);
        }
        rect(width / 3, height / 2 + 100, 300, 100);
        rect(width - width / 3, height / 2 + 100, 300, 100);
        
        textAlign(CENTER);
        comic = createFont("COMIC.TTF", 80);
        textFont(comic);
        if (settings.darkMode) {
            fill(255);
        }
        else{
            fill(0);
        }
        text("Jouer", width / 3, height / 2 + 125);
        comic = createFont("COMIC.TTF", 55);
        
        textFont(comic);
        text("Paramètres", width - width / 3, height / 2 + 125);
        if (mousePressed) {
           if (mouseX < width / 2 && mouseY > height / 2 + 50 && mouseY < height / 2 + 150) {// Bouton Gauche
                isPlayGame = true;
        }
           if (mouseX > width / 2 && mouseY > height / 2 + 50 && mouseY < height / 2 + 150) {// Bouton droit
                isSettings = true;
        }
        }
}
Axel PERSEVALLE's avatar
Axel PERSEVALLE a validé
}