Open adabo opened 4 years ago
Interesting approach! I've always kept my thoughts around AHK tools (with loops and such), so I did not search for "detect mouse movement, then update crosshair".
I'll need to find a weekend to start experimenting this. But alternatively, should you want to, feel free to do the changes, and send a pull request 😄
But alternatively, should you want to, feel free to do the changes, and send a pull request 😄
Ah, I suppose I could. I'll need to study the code a little longer to make sure I understand it all. No promises, but I'll see what I can do 😄
Had some time, so I took a shot at it. I did not use the class implementation in the link provided, since I find it rather complex. I found a similar implementation with less lines used:
https://www.autohotkey.com/boards/viewtopic.php?p=75116#p75116
I've pushed out the latest changes to the dev
branch. Will probably take a little more testing, fix the README file, and then a proper release. Feel free to experiment with the AHK file in the mean time.
I always prefer simple versus complex. If it's working and you understand the code, then I'd say you found your solution! I haven't tried the dev branch yet, and I'm not sure when I'll get around to it. I will let you know when I do. I hope you understand. Thanks!
U Could make it hide iself when the user press LMB/RMB so they dont overlap each other that way u cant notice the delay of the gui update. `
If (WinActive(ProcessIdentifier)) {
If (WinVisible("ahk_id " . CrosshairId) == 0) {
If !GetKeyState("LButton", "P") {
If !GetKeyState("RButton", "P") {
WinShow, ahk_id %CrosshairId%
WinActivate, %ProcessIdentifier%
}
}
}
MouseGetPos, MousePosX, MousePosY
MousePosX := MousePosX - 32
MousePosY := MousePosY - 32
WinMove, ahk_id %CrosshairId%, , MousePosX, MousePosY
If GetKeyState("LButton", "P") {
WinHide, ahk_id %CrosshairId%
}
If GetKeyState("RButton", "P") {
WinHide, ahk_id %CrosshairId%
}
}
Else {
WinHide, ahk_id %CrosshairId%
}
` This is the crosshair i use:
First, I want to say thanks for your work. I needed a way to display an overlay on a fullscreen game and your script worked. I just needed to change a few lines of code to fit my particular purpose.
For your case, however, you could use a DLLCall and catch all the mouse movement messages which would give you smoother crosshair motion and less CPU usage.
Here is the class that I found and I've tested that it does work. All you have to do is fit this into your script: https://www.autohotkey.com/boards/viewtopic.php?p=168246#p168246