Each time key pressed the mouse disappears into some strange coordinates (52662,52662), only on the mouse event it updates its position.
How are you determining this? I don’t see any text output or anything like that in your code…
Also, for responding to the various event types it makes more sense to use a switch statement or a series of else-if’s. (Since the type can only have a single value, there’s no point in using successive ‘if’ statements.)
i used cout.
cout << window->cursor.getX() << endl;
What is ‘window->cursor.getX()’? Is that your code, or some external library? Does the data come from SDL?
The only guess I can make based on the info you’ve provided is that you’re trying to access the mouse coordinates when the event is not a ‘mouse’ event. The SDL event type is a union, so what data is accessible and valid depends on what type of event is represented. In other words, the mouse position data will not always be valid/accessible.
If you need further help, I think you’ll need to provide more details about how and where you’re acquiring the mouse position data.
I don’t know if it’s the same bug, but I experienced something like that
with 1.2.? on Linux and reported it on this list a few years ago.
Only when you use fullscreen mode, when you hide the cursor, the mouse
gets warped to some semirandom location. There was some very convoluted
explanation related to fractional positions and the like, to understand
which you should know SDL internals - that I don’t.
I think at the end the general conclusion was that that was a bug, but I
have no idea if it got fixed and if yes, from which revision does it work.