// Menu


class MainMenu {
  PlayButton[] playButtons;
  BackGround bg;
  
  MainMenu() {
    camera = new Camera();
    camera.reset();
    
    bg = new BackGround(1);
    bg.Hue = 128;
    bg.Saturation = 100;
    bg.Brightness = 255;
    
    playButtons = new PlayButton[12];
    playButtons[0] = new PlayButton(0.3,0.4);
    playButtons[1] = new PlayButton(0.5,0.4);
    playButtons[2] = new PlayButton(0.7,0.4);
    playButtons[3] = new PlayButton(0.3,0.55);
    playButtons[4] = new PlayButton(0.5,0.55);
    playButtons[5] = new PlayButton(0.7,0.55);
    playButtons[6] = new PlayButton(0.3,0.7);
    playButtons[7] = new PlayButton(0.5,0.7);
    playButtons[8] = new PlayButton(0.7,0.7);
    playButtons[9] = new PlayButton(0.3,0.85);
    playButtons[10] = new PlayButton(0.5,0.85);
    playButtons[11] = new PlayButton(0.7,0.85);
  }
  
  
  void draw() {
    bg.draw();
    
    fill(0);
    textAlign(CENTER);
    textSize(72);
    text("\"What's Next, Captain?\"", width*0.5,80);
    
    for (int i=0; i<playButtons.length; i++) {
      playButtons[i].draw();
    }
  }
  
  class PlayButton {
    float x,y;
    float w = 190;
    float h = 90;
    PlayButton(float X,float Y) {
      x = X*width;
      y = Y*height;
    }
    void draw() {
      pushMatrix();
      translate(x,y);
      boolean isMouseOverMe = mouseX>x-w*0.5 && mouseX<x+w*0.5  &&  mouseY>y-h*0.5 && mouseY<y+h*0.5;
      if (isMouseOverMe) {
        fill(120,255,255);
      }
      else {
        fill(54,255,255);
      }
      stroke(54,255,200);
      strokeWeight(2);
      
      rect(0,0, w,h);
      
      fill(255);
      textAlign(CENTER);
      textSize(h*0.7);
      text("PLAY", 0,20);
      
      if (isMouseOverMe && mousePressed) {
        loadScene(SCENE_INTRODUCTION);
      }
      
      popMatrix();
    }
  }
      
  
}
