Пример #1
0
  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
  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;
        }
      }
    }
  }