import java.io.File;
import java.io.FileWriter;
import drop.*;
SDrop drop;

PImage backgroundImage;
PGraphics renderer;
String saveFilePath;
int activeMarkers;
int clickedMarkerID;
float scaleFactor = 1.0;
float translateX = 0.0;
float translateY = 0.0;
float viewX, viewY, viewportX, viewportW, viewportR, viewportY, viewportH, viewportB;
boolean zoomedState;
boolean draggingAsset;
boolean isImage(String path) {
  if (path.endsWith(".png") || path.endsWith(".PNG") ||
    path.endsWith(".gif") || path.endsWith(".GIF")) {
    return true;
  } else {
    return false;
  }
}

void setup() {
  marker = new Marker[200];
  frameRate(24);
  size(960, 540);
  //fullScreen;
  frame.setResizable(true);
  smooth();
  drop = new SDrop(this);
  backgroundImage = loadImage("assets/background.jpg");
  renderer = createGraphics(backgroundImage.width, backgroundImage.height);
  saveFilePath = dataPath("save.gse");
  loadSaveFile();
}

void draw() {
  background(246, 246, 244);
  calculateViewport();
  renderer.beginDraw();
  renderer.image(backgroundImage, 0, 0);
  renderer.fill(#FF0000);
  for (int i = 0; i < activeMarkers; i++) {
    marker[i].display();
  }
  renderer.endDraw();

  pushMatrix();
  translate(translateX, translateY);
  scale(scaleFactor);
  image(renderer, 0, 0, width, height);
  popMatrix();
}