Exemplo n.º 1
0
  @Override
  public void runFrame() {

    camera.getEyePosition().addX(cameraMovement.getX());
    camera.getLookAtPosition().addX(cameraMovement.getX());
    camera.getEyePosition().addZ(cameraMovement.getY());
    camera.getLookAtPosition().addZ(cameraMovement.getY());
    camera.update();
  }
Exemplo n.º 2
0
  @Override
  public void onMouseMoved(MouseMovedEvent e, int x, int y, int dx, int dy) {
    System.out.println("[Mouse Moved: x=" + x + " y=" + y + " dx=" + dx + " dy=" + dy + "]");
    if (x < PW_CAMERA_EDGEBUFFER) {
      cameraMovement.setX(-PW_CAMERA_MOVESPD);
    } else if (x > PetriClient.getInstance().getCanvasWidth() - PW_CAMERA_EDGEBUFFER) {
      cameraMovement.setX(PW_CAMERA_MOVESPD);
    } else {
      cameraMovement.setX(0);
    }

    if (y < PW_CAMERA_EDGEBUFFER) {
      cameraMovement.setY(-PW_CAMERA_MOVESPD);
    } else if (y > PetriClient.getInstance().getCanvasHeight() - PW_CAMERA_EDGEBUFFER) {
      cameraMovement.setY(PW_CAMERA_MOVESPD);
    } else {
      cameraMovement.setY(0);
    }
  }