diff --git a/examples/event/main.go b/examples/event/main.go index a77e3fc..4d0ad4f 100644 --- a/examples/event/main.go +++ b/examples/event/main.go @@ -17,11 +17,7 @@ import ( // "go-vgo/robotgo" ) -func event() { - //////////////////////////////////////////////////////////////////////////////// - // Global event listener - //////////////////////////////////////////////////////////////////////////////// - +func add() { fmt.Println("--- Please press v---") eve := robotgo.AddEvent("v") @@ -40,6 +36,14 @@ func event() { if feve == 0 { fmt.Println("You press...", "f1") } +} + +func event() { + //////////////////////////////////////////////////////////////////////////////// + // Global event listener + //////////////////////////////////////////////////////////////////////////////// + + add() fmt.Println("--- Please press left mouse button---") mleft := robotgo.AddEvent("mleft") diff --git a/examples/screen/main.go b/examples/screen/main.go index 0ff0ceb..123c428 100644 --- a/examples/screen/main.go +++ b/examples/screen/main.go @@ -17,11 +17,7 @@ import ( // "go-vgo/robotgo" ) -func screen() { - //////////////////////////////////////////////////////////////////////////////// - // Read the screen - //////////////////////////////////////////////////////////////////////////////// - +func bitmap() { abitMap := robotgo.CaptureScreen() fmt.Println("abitMap...", abitMap) gbit := robotgo.ToBitmap(abitMap) @@ -32,11 +28,9 @@ func screen() { // fmt.Println("...", gbitmap.Width, gbitmap.BytesPerPixel) robotgo.SaveCapture("saveCapture.png", 10, 20, 100, 100) +} - // gets the screen width and height - sx, sy := robotgo.GetScreenSize() - fmt.Println("...", sx, sy) - +func color() { // gets the pixel color at 100, 200. color := robotgo.GetPixelColor(100, 200) fmt.Println("color----", color, "-----------------") @@ -60,6 +54,20 @@ func screen() { fmt.Println("color---", color2) } +func screen() { + //////////////////////////////////////////////////////////////////////////////// + // Read the screen + //////////////////////////////////////////////////////////////////////////////// + + bitmap() + + // gets the screen width and height + sx, sy := robotgo.GetScreenSize() + fmt.Println("...", sx, sy) + + color() +} + func main() { screen() }