Jump to content
  • Advertisement


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


GetCursorPos() question (easily answered)

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

Can someone describe (or just give me some code) how to use GetCursorPos(); (windows api). Ive checked msdn.. and .. it didnt really help. I know i pass a structure with an x and y variable in (maybe a pointer to the structure (??), i really didnt understand the stuff at msdn) but I cant get anything to work.

Share this post

Link to post
Share on other sites

//Global variables for window pos

int g_windowX,g_windowY;


//Message handling

case WM_MOVE:
g_windowX = (int)LOWORD(lParam)
g_windowY = (int)HIWORD(lParam)


//In your game loop

pt.x -= g_windowX;
pt.y -= g_windowY;

[edited by - Hedos on March 19, 2004 10:13:59 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!