How to get the initial mouse coords before moving the mouse? |
Andre
Guest
|
Hi everybody,
I have a problem with `SDL_GetMouseState`: I want to get the inital mouse coords before the user moves the mouse, but the function only returns 0 for the x and y coord. I have attached a MWE that shows my problem. The first line that is printed is always "init: 0, 0". I expected it to give the actual coords. I tried this example under Linux only. I really appreciate any help you can provide. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|
Faluk
|
Hi Andre,
Do you have the event system initialized? PS. Can't see anything attached. |
|||||||||||
|
How to get the initial mouse coords before moving the mouse? |
Andre
Guest
|
SDL_GetMouseState.
http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20161110/13c00070/attachment.c for my attachment. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||||
|
How to get the initial mouse coords before moving the mouse? |
Andre
Guest
|
I'm not talking about the case where the mouse is outside the program. Run my attached program. Then remember the position of the window. Close the program. Then move the mouse into the position where the window was created last time. Start the program again. Now you can see that the initial call of SDL_GetMouseState always returns (0,0) although the mouse is inside the window. _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Re: How to get the initial mouse coords before moving the mo |
Faluk
|
Maybe is the library you are using. Your same code is is working perfectly for me:
|
|||||||||||||||||
|
How to get the initial mouse coords before moving the mouse? |
Andre
Guest
|
Ok, then it's a bug. Can you please tell me what operating system + DE + window manager you are using, so I can provide this information in the bug report? _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||||
|
Faluk
|
I currently tested your code under windows 7. I will try it under linux during the weekend.
|
|||||||||||
|
How to get the initial mouse coords before moving the mouse? |
Andre
Guest
|
Thank you very much for your help so far.
I filed a bug under https://bugzilla.libsdl.org/show_bug.cgi?id=3487 _______________________________________________ SDL mailing list http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org |
|||||||||||
|