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


Cursor position - problem

Recommended Posts

johan_swe    122
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