Beispiel #1
0
 private void splineMouse() {
   Line line1 = (Line) SPLINE_LINES.get(0);
   int lastX = line1.x1;
   int lastY = line1.y1;
   if (line1.x1 < 0 || line1.y1 < 0 || line1.x1 > 766 || line1.y1 > 504) {
     lastX = -1;
     lastY = -1;
   }
   for (int i = 0; i < SPLINE_LINES.size(); i++) {
     Line line = (Line) SPLINE_LINES.get(i);
     int x = line.x2;
     int y = line.y2;
     if (lastX != x || lastY != y && x > -1 && y > -1 && x < 766 && y < 504) {
       moveMouseInternal(lastX, lastY, x, y);
       lastX = x;
       lastY = y;
     } else if (lastX != x || lastY != y)
       try {
         int secs = 0;
         double nanos = 0.050000000000000003D - (double) secs;
         int nanosReal = (int) (nanos * 1000D);
         Thread.sleep(1, 10); // secs, nanosReal
       } catch (InterruptedException interruptedexception) {
       }
   }
 }
Beispiel #2
0
  private void generateSpline() {
    OUTLINE_LINES.clear();
    OUTLINE_POINTS.clear();
    SPLINE_LINES.clear();
    double step = 0.00130718954248366D;
    double t = 0.00130718954248366D;
    DoublePoint points2[] = new DoublePoint[n];
    int Xold = (int) points[0].x;
    int Yold = (int) points[0].y;
    for (int i = 0; i < n; i++) {
      int X = (int) points[i].x;
      int Y = (int) points[i].y;
      OUTLINE_POINTS.add(new Point(X, Y));
    }

    if (n > 2) {
      int Xo = Xold;
      int Yo = Yold;
      for (int i = 1; i < n; i++) {
        int X = (int) points[i].x;
        int Y = (int) points[i].y;
        OUTLINE_LINES.add(new Line(Xo, Yo, X, Y));
        Xo = X;
        Yo = Y;
      }
    }
    for (int k = 1; k < 765; k++) {
      System.arraycopy(points, 0, points2, 0, n);
      for (int j = n - 1; j > 0; j--) {
        for (int i = 0; i < j; i++) {
          points2[i].x = (1.0D - t) * points2[i].x + t * points2[i + 1].x;
          points2[i].y = (1.0D - t) * points2[i].y + t * points2[i + 1].y;
        }
      }

      int X = (int) points2[0].x;
      int Y = (int) points2[0].y;
      SPLINE_LINES.add(new Line(Xold, Yold, X, Y));
      Xold = X;
      Yold = Y;
      t += 0.00130718954248366D;
    }
  }
Beispiel #3
0
  public void moveMouse(int x, int y, int randomX, int randomY) {
    int thisX = getLocation().x;
    int thisY = getLocation().y;
    if (thisX < 0 || thisY < 0)
      switch (nextInt(1, 5)) {
        case 1: // '\001'
          thisX = 1;
          thisY = nextInt(0, 500);
          setMousePos(thisX, thisY);
          break;

        case 2: // '\002'
          thisX = nextInt(0, 765);
          thisY = 501;
          setMousePos(thisX, thisY);
          break;

        case 3: // '\003'
          thisX = 766;
          thisY = nextInt(0, 500);
          setMousePos(thisX, thisY);
          break;

        case 4: // '\004'
          thisX = nextInt(0, 765);
          thisY = 1;
          setMousePos(thisX, thisY);
          break;
      }
    if (thisX == x && thisY == y) return;
    if (Point2D.distanceSq(thisX, thisY, x, y) < 10D) {
      SPLINE_LINES.clear();
      SPLINE_LINES.add(new Line(thisX, thisY, nextInt(x, x + randomX), nextInt(y, y + randomY)));
    } else {
      createSpline(
          new Point(thisX, thisY), new Point(nextInt(x, x + randomX), nextInt(y, y + randomY)));
    }
    splineMouse();
  }