mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update code style and remove useless code
This commit is contained in:
parent
87e23b9adf
commit
54f78e2aa8
@ -97,25 +97,6 @@ int count_of_bitmap(MMBitmapRef bitmap, MMBitmapRef sbit, float tolerance){
|
|||||||
return countOfBitmapInRect(bitmap, sbit, rect, tolerance);
|
return countOfBitmapInRect(bitmap, sbit, rect, tolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
MMPoint aFindBitmap(MMBitmapRef bit_map, MMRect rect){
|
|
||||||
// MMRect rect;
|
|
||||||
// rect.size.width = 10;
|
|
||||||
// rect.size.height = 20;
|
|
||||||
// rect.origin.x = 10;
|
|
||||||
// rect.origin.y = 20;
|
|
||||||
|
|
||||||
float tolerance = 0.0f;
|
|
||||||
MMPoint point;
|
|
||||||
|
|
||||||
tolerance = 0.5;
|
|
||||||
|
|
||||||
if (findBitmapInRect(bit_map, bit_map, &point,
|
|
||||||
rect, tolerance) == 0) {
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
return point;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point_in_bounds(MMBitmapRef bitmap, MMPoint point){
|
bool point_in_bounds(MMBitmapRef bitmap, MMPoint point){
|
||||||
if (!bitmap_ready(bitmap)) {
|
if (!bitmap_ready(bitmap)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
28
robotgo.go
28
robotgo.go
@ -542,12 +542,11 @@ func KeyTap(tapKey string, args ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// fmt.Println("err:::", e)
|
|
||||||
akey = "null"
|
akey = "null"
|
||||||
keyArr = []string{"null"}
|
keyArr = []string{"null"}
|
||||||
}
|
}
|
||||||
// }()
|
|
||||||
|
|
||||||
|
// zkey := C.CString(args[0])
|
||||||
zkey := C.CString(tapKey)
|
zkey := C.CString(tapKey)
|
||||||
defer C.free(unsafe.Pointer(zkey))
|
defer C.free(unsafe.Pointer(zkey))
|
||||||
|
|
||||||
@ -558,7 +557,6 @@ func KeyTap(tapKey string, args ...interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// zkey := C.CString(args[0])
|
|
||||||
amod := C.CString(akey)
|
amod := C.CString(akey)
|
||||||
amodt := C.CString(keyT)
|
amodt := C.CString(keyT)
|
||||||
|
|
||||||
@ -935,30 +933,6 @@ func CountBitmap(bitmap, sbit C.MMBitmapRef, args ...float32) int {
|
|||||||
return int(count)
|
return int(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindBit find the bitmap, Wno-deprecated
|
|
||||||
func FindBit(args ...interface{}) (int, int) {
|
|
||||||
var bit C.MMBitmapRef
|
|
||||||
bit = args[0].(C.MMBitmapRef)
|
|
||||||
|
|
||||||
var rect C.MMRect
|
|
||||||
Try(func() {
|
|
||||||
rect.origin.x = C.size_t(args[1].(int))
|
|
||||||
rect.origin.y = C.size_t(args[2].(int))
|
|
||||||
rect.size.width = C.size_t(args[3].(int))
|
|
||||||
rect.size.height = C.size_t(args[4].(int))
|
|
||||||
}, func(e interface{}) {
|
|
||||||
// fmt.Println("err:::", e)
|
|
||||||
// rect.origin.x = x
|
|
||||||
// rect.origin.y = y
|
|
||||||
// rect.size.width = w
|
|
||||||
// rect.size.height = h
|
|
||||||
})
|
|
||||||
|
|
||||||
pos := C.aFindBitmap(bit, rect)
|
|
||||||
// fmt.Println("pos----", pos)
|
|
||||||
return int(pos.x), int(pos.y)
|
|
||||||
}
|
|
||||||
|
|
||||||
// BitmapClick find the bitmap and click
|
// BitmapClick find the bitmap and click
|
||||||
func BitmapClick(bitmap C.MMBitmapRef, args ...interface{}) {
|
func BitmapClick(bitmap C.MMBitmapRef, args ...interface{}) {
|
||||||
x, y := FindBitmap(bitmap)
|
x, y := FindBitmap(bitmap)
|
||||||
|
Loading…
Reference in New Issue
Block a user