示例#1
0
文件: Look.java 项目: Gogoro/Undef
  public synchronized void mouseMoved(MouseEvent e) {
    if (centering && center.x == e.getX() && center.y == e.getY()) {
      centering = false;
    } else {
      int dx = e.getX() - mouse.x;
      int dy = e.getY() - mouse.y;
      image.x += dx;
      image.y += dy;
      recenterMouse();
    }

    mouse.x = e.getX();
    mouse.y = e.getY();
  }
示例#2
0
文件: Look.java 项目: Gogoro/Undef
  // init
  public void init() {
    super.init();
    mouse = new Point();
    center = new Point();
    image = new Point();
    centering = false;

    try {
      robot = new Robot();
      recenterMouse();
      mouse.x = center.x;
      mouse.y = center.y;
    } catch (Exception e) {
      System.out.println("Exception 1");
    }

    Window w = s.getFullScreenWindow();
    w.addMouseMotionListener(this);
    w.addKeyListener(this);
    bg = new ImageIcon("/Users/Ole/Desktop/undefined/images/bg.jpg").getImage();
  }