Skip to main content
gamedev.net
🔒 Locked

mouse coordinates?

Started by pyro1245 Dec 23, 2002 at 10:16 PM 1 replies 550+ views
Original Post
pyro1245
pyro1245
how can i get the coordinates of the mouse cursor on an opengl window? thanks
mrbastard
mrbastard
The input side of things is handled by the OS interface API you are using - win32 API, SDL, etc

Some of the nehe tuts use mouse input so you could learn from them. nehe uses win32 API, but there are many alternatives. Direct Input or win32 API are generally used by windows-only coders, and SDL by others.

Overall I''d use the win32 stuff if you''re on windows and want a quick hack to make it work, or SDL if you''re willing to invest a little time - SDL does lots of very useful things very well on most platforms. check out www.libsdl.org
[size="1"]
Hawkeye3
Hawkeye3
POINT point;

GetCursorPos(&point);

point.x;
point.y;

This is the location of the actual cursor in x and y. Remember, the coordinates relative from the top left, not the bottom left.

Topic Locked

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

Sign in to reply to this topic.