Jump to content
  • Advertisement
Sign in to follow this  
be17_17y

Mouse points wrong place!!

This topic is 4877 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 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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!