mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-29 21:43:55 +00:00
Fixed: fixed windows Scale #713 and Update readme.md
This commit is contained in:
parent
6a1f060a8c
commit
df0731c4df
24
README.md
24
README.md
@ -61,6 +61,9 @@ GCC
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### For MacOS:
|
#### For MacOS:
|
||||||
|
```
|
||||||
|
brew install go
|
||||||
|
```
|
||||||
|
|
||||||
Xcode Command Line Tools (And Privacy setting: [#277](https://github.com/go-vgo/robotgo/issues/277))
|
Xcode Command Line Tools (And Privacy setting: [#277](https://github.com/go-vgo/robotgo/issues/277))
|
||||||
|
|
||||||
@ -69,8 +72,15 @@ xcode-select --install
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### For Windows:
|
#### For Windows:
|
||||||
|
```
|
||||||
|
winget install Golang.go
|
||||||
|
```
|
||||||
|
|
||||||
[MinGW-w64](https://sourceforge.net/projects/mingw-w64/files) (Use recommended) or others Mingw [llvm-mingw](https://github.com/mstorsjo/llvm-mingw);
|
```
|
||||||
|
winget install MartinStorsjo.LLVM-MinGW.UCRT
|
||||||
|
```
|
||||||
|
|
||||||
|
Or [MinGW-w64](https://sourceforge.net/projects/mingw-w64/files) (Use recommended) or others Mingw [llvm-mingw](https://github.com/mstorsjo/llvm-mingw);
|
||||||
|
|
||||||
Download the Mingw, then set system environment variables `C:\mingw64\bin` to the Path.
|
Download the Mingw, then set system environment variables `C:\mingw64\bin` to the Path.
|
||||||
[Set environment variables to run GCC from command line](https://www.youtube.com/results?search_query=Set+environment+variables+to+run+GCC+from+command+line).
|
[Set environment variables to run GCC from command line](https://www.youtube.com/results?search_query=Set+environment+variables+to+run+GCC+from+command+line).
|
||||||
@ -96,6 +106,9 @@ X11 with the XTest extension (the Xtst library)
|
|||||||
##### Ubuntu:
|
##### Ubuntu:
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
|
# sudo apt install golang
|
||||||
|
sudo snap install go --classic
|
||||||
|
|
||||||
# gcc
|
# gcc
|
||||||
sudo apt install gcc libc6-dev
|
sudo apt install gcc libc6-dev
|
||||||
|
|
||||||
@ -165,11 +178,18 @@ Note go1.10.x C file compilation cache problem, [golang #24355](https://github.c
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/go-vgo/robotgo"
|
"github.com/go-vgo/robotgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
robotgo.MouseSleep = 100
|
robotgo.MouseSleep = 300
|
||||||
|
|
||||||
|
robotgo.Move(100, 100)
|
||||||
|
fmt.Println(robotgo.Location())
|
||||||
|
robotgo.Move(100, -200) // multi screen supported
|
||||||
|
robotgo.MoveSmooth(120, -150)
|
||||||
|
fmt.Println(robotgo.Location())
|
||||||
|
|
||||||
robotgo.ScrollDir(10, "up")
|
robotgo.ScrollDir(10, "up")
|
||||||
robotgo.ScrollDir(20, "right")
|
robotgo.ScrollDir(20, "right")
|
||||||
|
@ -506,7 +506,7 @@ func CheckMouse(btn string) C.MMMouseButton {
|
|||||||
|
|
||||||
// MoveScale calculate the os scale factor x, y
|
// MoveScale calculate the os scale factor x, y
|
||||||
func MoveScale(x, y int, displayId ...int) (int, int) {
|
func MoveScale(x, y int, displayId ...int) (int, int) {
|
||||||
if Scale && runtime.GOOS == "windows" {
|
if Scale || runtime.GOOS == "windows" {
|
||||||
f := ScaleF()
|
f := ScaleF()
|
||||||
x, y = Scaled1(x, f), Scaled1(y, f)
|
x, y = Scaled1(x, f), Scaled1(y, f)
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ func Location() (int, int) {
|
|||||||
x := int(pos.x)
|
x := int(pos.x)
|
||||||
y := int(pos.y)
|
y := int(pos.y)
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if Scale || runtime.GOOS == "windows" {
|
||||||
f := ScaleF()
|
f := ScaleF()
|
||||||
x, y = Scaled0(x, f), Scaled0(y, f)
|
x, y = Scaled0(x, f), Scaled0(y, f)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user