Advertisement Jump to content


This topic is now archived and is closed to further replies.


Cursor position - problem

This topic is 5411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m using Direct3D 9.0 (Summer Update 2003) to render text (using the ID3DXFont interface). I have made a wrapper class for this, which also detects if the cursor is over the text. The problem is that I can''t get i accurate. The class generates a RECT from the text using DT_CALCRECT and then checks if the cursor is over the text using if(Point.x >= Rect.left && Point.x <= Rect.right && Point.y >= && Point.y <= Rect.bottom)) where Point is the cursor position. It seems like the actual rectangle that triggers my OnMouseOver test is placed below the right one. Here''s a [url=]screenshot[/url]. The white rectangle around the text was rendered in-game by ID3DXLine, and was generated from the text''s calculated rectangle. In other words, it''s probably not that text/rectangle that is wrong, but the cursor. The red rectangle was added in photoshop as an approximation for the area where my OnMouseOver test is triggered. I have tried both WM_MOUSEMOVE and GetCursorPos() + ScreenToClient().

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!