Skip to main content
gamedev.net
🔒 Locked

Checking current mouse position

Started by Eldritch Jun 2, 2006 at 12:53 PM 1 replies 650+ views
Original Post
Eldritch
Eldritch
Hi! I just tried to implement a function for my input manager that checks the current mouse position. Now.. I remember that the function is GetCursorPos, but as with everything else, they have changed it enough for it to become unusable. Previously, it would take the position inside the window that calls the GetCursorPos function, but now it seems like it take the screen coordinates instead, which makes it impossible to check if the cursor is inside a specific area in my program. Next.. they have added some form of stupid pointer (LPPOINT) instead of the function returning a simple POINT. Now, what's up with that? No matter how I do it, I never get any results using GetCursorPos any longer. Does anyone here have any suggestions for some other method of checking the mouse position? (I am guessing they are ruining their own Windows functions in order for people to move over to DirectX, which would be stupid)
BeanDog
BeanDog
POINT mouse;
GetCursorPos(&mouse);
ScreenToClient(hWnd, &mouse);

LPPOINT == POINT*. The reason that these functions take pointers is that they intend to change the content of your point inside the function. To get a pointer to your object, use the & operator as above.

In real C++ code, this could (and probably should) be done by passing the point in by reference, but these API's were written for use in straight C.
Eldritch
Eldritch
Aah, that is very different from what I have all these years. I guess they are trying to get rid of the old working stuff and replacing it with new "oh look how cool it is" stuff that does not work :D

Thank you for the help though, much appreciated.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.