let font;

function setup() { // In godot is dit de ready function
  createCanvas(400, 400);
  angleMode(DEGREES) // Zorg dat alles graden is
}

function preload() {
  font = loadFont("/../assets_week_1/Fonts/PublicPixel.ttf")
}

function draw() { // In godot is dit de process function
  background(220);

  // Variabelen
  let seconds = second();
  let hours = hour();
  let minutes = minute();
  let tussenTekstHours = "	";
  let tussenTekstMinutes = ":";
  let tussenTekstSeconds = ":";

  // Maak de digitale klok
  noStroke();
  fill(77);
  rect(10, 95, 115, 36, 20, 20);
  fill(0);
  rect(15, 100, 105, 26, 20, 20);
  
  // Tekstinstellingen
  textFont(font);
  text("X:" + str(round(mouseX)), 0, 24);
  text("Y:" + str(round(mouseY)), 0, 48);
  

  // Maak de text correct
  fill(255,0,0);
  if (hours < 10) {
    tussenTekstHours = "	0";
  }
  if (minutes < 10) {
    tussenTekstMinutes = ":0";
  }
  if (seconds < 10) {
    tussenTekstSeconds = ":0";
  }                         
  text(tussenTekstHours + str(hours) +
   tussenTekstMinutes + str(minutes) + tussenTekstSeconds 
  + str(seconds), -5, 118);

  // Analoge klok
  fill(0);
  circle(200, 250, 110);
  fill(255);
  circle(200, 250, 100);

  // Maak seconden teller
  stroke(0);
  strokeWeight(1);
  translate(200, 250); // Zet origin in midden
  rotate(seconds * 6);
  line(0, 0, 0, -50);

  // Maak minuten teller
  strokeWeight(3);
  rotate(minutes * 6 - (seconds * 6));
  line(0, 0, 0, -50);

  // Maak hour teller
  strokeWeight(5);
  rotate(hours * 30 - minutes * 6);
  line(0, 0, 0, -25);

  

}