Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: 获取正确的客户端画面分辨率应该使用GetClientRect方法 #30

Closed
chunibyo-wly opened this issue Apr 16, 2022 · 2 comments

Comments

@chunibyo-wly
Copy link
Contributor

mdt/mdt_cv.py

Line 87 in 89f086b

box = win32gui.GetWindowRect(hwnd)

GetWindowRect获得的分辨率应该是包含标题栏的,这个会导致使用模板匹配方法的时候难以正常的将屏幕位置算出来。
这里的box大小如果客户端设置的是1600x900,打印出来应该就是这个值。
如果需要用到屏幕坐标,再通过win32gui.ClientToScreen(hWnd, (0, 0))方法获得Client位置就行了。

不过这个有一个问题是看起来这里取得的值是和大佬你的图像hash绑定的,所以我就不方便直接修改了。

@chunibyo-wly
Copy link
Contributor Author

image
或者直接把接口改成这样,啥也不用改

@SkywalkerJi
Copy link
Owner

SkywalkerJi commented Apr 16, 2022

测试完可以pr。图像hash只和卡图部分有关,BOXES 坐标控制的卡图匹配位置。

我之前测试用的截图:
https://drive.google.com/drive/folders/1fbUY6CUfV9TA5i4r7jBVbhmSzu2BzUa-?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants