public void update(float dt) {
    if (this.state == EDIT_SHAPE) {
      if (es.vertexCount() > 0) {
        int i = es.findClosestLineStrip(Mouse.getX(), Mouse.getY());
        if (i != -1) {
          int next = (i + 1 > es.vertexCount()) ? 0 : i + 1;
          tgl.reshape(es.getVertex(i), es.getVertex(next), Mouse.getX(), Mouse.getY());
          if (!tgl.isLocked()) vertex = next;
        } else {
          if (!tgl.isLocked()) vertex = -1;
        }
      }
    } else if (this.state == MOVE_SHAPE) {

    }
  }
 public void setEditiblyShape(EditblyShape es) {
   this.es = es;
   if (es.vertexCount() < 3) {
     state = NEW_SHAPE;
   } else {
     state = EDIT_SHAPE;
   }
 }
 public void mouseEvent(int mouseButton, boolean state, int x, int y) {
   if (state) {
     switch (mouseButton) {
       case 0:
         break;
     }
   } else {
     switch (mouseButton) {
       case 0:
         if (this.state == NEW_SHAPE) {
           es.add(new Vertex2DPosition(x, y));
         } else if (this.state == EDIT_SHAPE) {
           if (vertex != -1) {
             es.add(vertex, new Vertex2DPosition(x, y));
           }
         }
         tgl.setLocked(false);
         break;
     }
   }
 }