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

Mouse points wrong place!!

Started by be17_17y Aug 5, 2005 at 7:19 AM 0 replies 900+ views
Original Post
be17_17y
be17_17y
i got some weird problem when i used LPARAM variable of winproc CALLBACK function to obtain x and y screen coordinate of mouse (it's to check intersect of my Terrain (MeshFvF) using RAY), when I click on the terrain the result of D3DXIntersect return correct face index, But the problem appear when I try using : POINT pt; GetCursorPos( &pt ); // pt.x as mouse x coord. // pt.y as mouse y coord. when i click on terrain, for example in face 0, i got face index result larger than 0, and i for make sure, i click on empty space left of triangle face 0, i got face index result = 0 or above. so it's like the vertices of terrain and the loaded vertices of vertexbuffer are not in the same position. i have check all code...but nothing wrong... So..can somebody please explain to me what's the different between those two method above of gaining mouse coordinate......?? Do you have another better method to get mouse xy position ???? Thanx
e-u-l-o-g-y
e-u-l-o-g-y
I would guess that it's caused by the fact that the GetCursorPos function returns the point in screen coordinates, while the WM_MOUSEMOVE returns coordinates relative to the upper left corner of the client area.

Edit:
Use ScreenToClient to convert from screen coordinates to client coordinates

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/cordspac_5oxg.asp
my-eulogy - A blog about coding and gfxsdgi - Semi-Daily Game IdeaChunkyHacker - Viewer for Relic chunky formats (used in DOW)

Topic Locked

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

Sign in to reply to this topic.