getting mouse coordinates

Started by
4 comments, last by TOmcAT23 19 years, 8 months ago
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
Advertisement
Hello

If you use Windows, you can go for

POINT CurPos;
GetCursorPos(&CurPos);

to get current mouse coordinates.

Bye
___Quote:Know where basis goes, know where rest goes.
POINT? , what will that do? , and what does it return? , the x position of the mous eor the y position of the mouse?
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.
aw , thanks for clearing that up , I'll see what i can do
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
-Keith

This topic is closed to new replies.

Advertisement