예제 #1
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void mouseClicked() {

    //  int id = camPicker.get(mouseX, mouseY);
    int id = picker.get(mouseX, mouseY);
    if (id > -1) {
      for (int i = 0; i < cameras.size(); i++) {
        if (i == id) {
          cameras.get(id).changeToSelectedColor();
          cameras.get(id).isSelected = true;
        } else {
          cameras.get(i).setDefaultColor();
          cameras.get(i).isSelected = false;
        }
      }
    }
  }
예제 #2
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void mouseDragged() {

    //  int id = camPicker.get(mouseX, mouseY);
    int id = picker.get(mouseX, mouseY);
    /*
    //keep objects from being selected while dragging other objects; DOESN'T FIX ANYTHING YET
     if(id > -1 && id == prevID){
     //    cameras.get(id).changeToDragColor();
     println("indragged same");
     cameras.get(id).drag(mouseX, mouseY);
     }
     */
    if (id > -1) {
      for (int i = 0; i < cameras.size(); i++) {
        if (i == id) {
          //        println("indragged diff " + " x is " + mouseX + " y is " + mouseY);
          // cameras.get(id).changeToDragColor();
          cameras.get(id).drag(mouseX, mouseY);
          prevID = id;
          break;
        }
      }

      //    int id = camPicker.get(mouseX, mouseY);

      for (int i = cameras.size(); i < cameras.size() + characters.size(); i++) {
        //        println(i + " hi " + " camSize is " + cameras.size() + " charSize is" +
        // characters.size() + " both together are " + cameras.size() + characters.size());
        if (i == id) {
          //          characters.get(id).changeToDragColor();

          characters.get(id - cameras.size()).drag(mouseX, mouseY);
          //          println("char is " + id);
          break;
        }
      }
    }
  }
예제 #3
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void draw() { // display things

    // execute sceneManager stuff
    resetMatrix();
    // beginCamera();
    camera();
    rotateX(HALF_PI);
    translate(globalCameraX, globalCameraY, globalCameraZ);

    /* rotation using a and d
    PMatrix3D foRealCameraMatrix=new PMatrix3D();
    getMatrix(foRealCameraMatrix);
    */
    // translate(0,-100, -400 );
    // translate(0,0, 0 );
    // rotate(sin(millis() * 0.001), 1,0,0);

    background(bGround);

    for (int i = 0; i < cameras.size(); i++) {
      //    camPicker.start(i);  //add picker to each cam
      picker.start(i);
      cameras.get(i).display();
    }
    //  camPicker.stop();

    for (int i = cameras.size(); i < cameras.size() + characters.size(); i++) {
      //    charPicker.start(i);
      picker.start(i);
      characters.get(i - cameras.size()).display();
    }
    //  charPicker.stop();
    picker.stop();

    // endCamera();

    //  int id = camPicker.get(mouseX, mouseY);
    //  if (id > -1) {
    //    for (int i=0; i<cameras.size(); i++) {
    //      if (i == id) {
    //        cameras.get(id).changeToSelectedColor();
    //        cameras.get(id).isSelected = true;
    //      } else {
    //        cameras.get(i).setDefaultColor();
    //        cameras.get(i).isSelected = false;
    //      }
    //    }
    //  }

    // checks for rule violations
    int id = -1;
    for (int i = 0; i < cameras.size(); i++) {
      if (cameras.get(i).isSelected) {
        if (selectedRule == 0) rulesChecker.checkLineOfAction(cameras, characters, i);
        else if (selectedRule == 1) rulesChecker.checkThirtyDegreeRule(cameras, characters, i);
        else resetAllCams();
      }
    }

    rulesChecker.checkCuttingOnAction(sm, timeline);
    rulesChecker.checkPacing(sm, timeline);

    /* This is for camera rotation using a and d
    resetMatrix();
    pushMatrix();
    setMatrix(myCamera);
    rotate(angle);
    getMatrix();
    popMatrix;
    */

    // have to rotate back to original orientation in order to properly display the drop-down menu

    rotateX(PI);
    rotateX(HALF_PI);

    controlP5.draw();
    timeline.draw();
  }