getting mouse coordinates
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
Hello
If you use Windows, you can go for
POINT CurPos;
GetCursorPos(&CurPos);
to get current mouse coordinates.
Bye
If you use Windows, you can go for
POINT CurPos;
GetCursorPos(&CurPos);
to get current mouse coordinates.
Bye
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.
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.
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
GetCursorPos gives relative coords
ScreenToClient(HWND,POINT) converts relative coords to window coords and ClientToScreen(HWND,POINT) does the reverse.
-TOmcAT
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement