好的,如果对象没有移动,创建鼠标悬停事件真的很容易。
但问题是物体每 50 毫秒就会移动一次。
它不是字符串,所以我可以创建一个脚本,它是一个圆圈。
我曾经使用 getcursorpos()。比得到对象 x 和 y。
另一个问题是,
p X---------------------
y
|
|
|
| cursor
|
|
|
它说 p 是 x 和 y 得到的位置。
如果我获取光标的位置并将其与它们不匹配的 x 和 y 进行比较,则光标在中间的位置。
而且物体不断移动,因此更难追踪。
有什么想法吗?
抱歉,如果我所说的令人困惑,我无法更好地解释它。
ok s it is really easy to create mouse over event if the object is NOT moving.
but the problem that the object gonna be moving every 50 millisecond.
it is not a string line so i can create a script it is a circle.
i used to use getcursorpos(). than get the object x and y.
the other problem is this
p X---------------------
y
|
|
|
| cursor
|
|
|
where it says p that is the position ill get for the x and y.
where is the cursor in the middle if ill get the position of the cursor and compare it to the x and y they won't match.
plus the object keeps moving so it is harder to track.
any idea?
sorry if what i said is confusing i couldn't explain it better.
发布评论
评论(1)
如果您遵循 GetCursorPos 文档,它会显示:
但是当您绘制时,您必须提供客户端坐标。这是您需要使用适当命名的函数从屏幕坐标转换为客户端坐标的问题吗 ScreenToClient。
但我建议不要手动跟踪光标位置,而是使用 WM_MOUSEMOVE 事件,它已经为您提供了客户端坐标。
If you follow the GetCursorPos documentation it say:
But when you draw you have to provide client coordinates. Is this is the issue you will need to transform from screen coordinates to client coordinates with the function aptly named ScreenToClient.
But instead of tracking the cursor position by hand I suggest to use the WM_MOUSEMOVE event, which already provides you with the client coordinates.