Skip to main content
GameDev.net gamedev.net
🔒 Locked

Cursor position - problem

Started by johan_swe Mar 29, 2004 at 3:28 PM 0 replies 250+ views
Original Post
johan_swe
johan_swe
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 >= Rect.top && 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=http://w1.353.telia.com/~u35306061/mouse.jpg]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().

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.