Jump to content
  • Advertisement
Sign in to follow this  
stealth

getting mouse coordinates

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

Hey , I need a function which will return the current mouse screen coordinates? , I'm using DevC++ , I just dont know what function to use , any help would be appreciated cheers Stealth

Share this post


Link to post
Share on other sites
Advertisement
Hello

If you use Windows, you can go for

POINT CurPos;
GetCursorPos(&CurPos);

to get current mouse coordinates.

Bye

Share this post


Link to post
Share on other sites
POINT? , what will that do? , and what does it return? , the x position of the mous eor the y position of the mouse?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
POINT is a struct that contains both x and y coordinates.
POINT mypoint;
mypoint.x = 10;
mypoint.y = 20;

I can't remember if windows returns absolute or relative coordinates, but they can be converted with some equally obscure win32api functions. Windows operates with both screen, absolute and relative coordinates if I remember correctly. It's a pain, but you only have to write the code once in your game.

Share this post


Link to post
Share on other sites
Just to clear this up...
GetCursorPos gives relative coords
ScreenToClient(HWND,POINT) converts relative coords to window coords and ClientToScreen(HWND,POINT) does the reverse.

-TOmcAT

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!