[SDL] Getting the mouse position

Charles MacDonald chamacd at gmail.com
Thu Sep 14 09:53:21 PDT 2006


I'd like to add a standard Windows right-click popup menu to my
program. The mouse coordinates returned by an SDL mouse event are
relative to the application window's upper-left corner, however I need
them relative to the upper-left corner of the desktop.

I tried using SDL_EventState() to ignore the SDL_MOUSEBUTTONDOWN/UP
event, but the window dialog proc never picks up a mouse event. Though
ideally I'd like to keep SDL mouse event handling intact.

Is there another way I can either get the absolute mouse position on
the screen/desktop, or the position of the application window to
adjust the window-relative coordinates by?



More information about the SDL mailing list