diff --git a/mouse/goMouse.h b/mouse/goMouse.h index 87be82c..dbdcb12 100644 --- a/mouse/goMouse.h +++ b/mouse/goMouse.h @@ -16,7 +16,8 @@ int mouseDelay = 10; // int keyboardDelay = 10; -// int CheckMouseButton(const char * const b, MMMouseButton * const button){ +// int CheckMouseButton(const char * const b, +// MMMouseButton * const button){ // if (!button) return -1; // if (strcmp(b, "left") == 0) @@ -74,7 +75,7 @@ int move_mouse_smooth(size_t x, size_t y, double lowSpeed, } -MMPoint get_mousePos(){ +MMPoint get_mouse_pos(){ MMPoint pos = getMousePos(); // Return object with .x and .y. diff --git a/mouse/mouse_c.h b/mouse/mouse_c.h index 7b1794c..e9389bd 100644 --- a/mouse/mouse_c.h +++ b/mouse/mouse_c.h @@ -334,10 +334,12 @@ bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed) double velo_x = 0.0, velo_y = 0.0; double distance; - while ((distance = crude_hypot((double)pos.x - endPoint.x, - (double)pos.y - endPoint.y)) > 1.0) { - // double gravity = DEADBEEF_UNIFORM(5.0, 500.0); - double gravity = DEADBEEF_UNIFORM(lowSpeed, highSpeed); + while ((distance = + crude_hypot((double)pos.x - endPoint.x, (double)pos.y - endPoint.y)) + > 1.0) { + + double gravity = DEADBEEF_UNIFORM(5.0, 500.0); + // double gravity = DEADBEEF_UNIFORM(lowSpeed, highSpeed); double veloDistance; velo_x += (gravity * ((double)endPoint.x - pos.x)) / distance; velo_y += (gravity * ((double)endPoint.y - pos.y)) / distance; @@ -359,7 +361,8 @@ bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed) moveMouse(pos); /* Wait 1 - 3 milliseconds. */ - microsleep(DEADBEEF_UNIFORM(1.0, 3.0)); + microsleep(DEADBEEF_UNIFORM(lowSpeed, highSpeed)); + // microsleep(DEADBEEF_UNIFORM(1.0, 3.0)); } return true; diff --git a/robotgo.go b/robotgo.go index 0e7ee3c..8759e58 100644 --- a/robotgo.go +++ b/robotgo.go @@ -63,7 +63,7 @@ import ( ) const ( - version string = "v0.48.0.508, Ben Nevis!" + version string = "v0.48.0.509, Ben Nevis!" ) type ( @@ -393,8 +393,8 @@ func MoveMouseSmooth(x, y int, args ...interface{}) { low = C.double(args[0].(float64)) high = C.double(args[1].(float64)) } else { - low = 5.0 - high = 500.0 + low = 1.0 + high = 3.0 } C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay)) @@ -420,8 +420,8 @@ func MoveSmooth(x, y int, args ...interface{}) { low = C.double(args[0].(float64)) high = C.double(args[1].(float64)) } else { - low = 5.0 - high = 500.0 + low = 1.0 + high = 3.0 } C.move_mouse_smooth(cx, cy, low, high, C.int(mouseDelay)) @@ -429,7 +429,7 @@ func MoveSmooth(x, y int, args ...interface{}) { // GetMousePos get mouse portion func GetMousePos() (int, int) { - pos := C.get_mousePos() + pos := C.get_mouse_pos() // fmt.Println("pos:###", pos, pos.x, pos.y) x := int(pos.x) y := int(pos.y)