Sdl_warpmouse Problems With Oopo/paeryn's Sdl


sparr

Member
Joined
Jun 3, 2006
Messages
292
I have compiled a game with GPH's toolchain and SDL and it runs, albeit slowly. I added code in the screen update loop to poll the joystick buttons and move the mouse cursor via SDL_WarpMouse. All was well with the mouse cursor. Then I decided to compile the same game with oopo's toolchain. Once I resolved the library dependency issues introduced by -static, I got a working binary, but now the mouse cursor doesn't move. I put printfs in the appropriate places and can see that I am definitely calling SDL_WarpMouse with the appropriate parameters, and it is in turn calling current_video->WarpWMCursor with those same corect parameters. Beyond that I am sorta lost. That function is provided by src/video/gp2x/SDL_gp2xvideo.c unless I am mistaken, and it assigns the new coordinates directly into members of the current SDL_VideoDevice, so I can only assume that those newly assigned coordinates are being lost or not read correctly somewhere.

I am going to try to build oopo's SDL with fbcon, like GPH, instead of the custom gp2x video driver. If that fixes the problem then I can possibly provide more information. Failing that, any input would be appreciated.
 
Sparr posted on Aug 7 2006 at 12:57 AM said:
I have compiled a game with GPH's toolchain and SDL and it runs, albeit slowly. I added code in the screen update loop to poll the joystick buttons and move the mouse cursor via SDL_WarpMouse. All was well with the mouse cursor. Then I decided to compile the same game with oopo's toolchain. Once I resolved the library dependency issues introduced by -static, I got a working binary, but now the mouse cursor doesn't move. I put printfs in the appropriate places and can see that I am definitely calling SDL_WarpMouse with the appropriate parameters, and it is in turn calling current_video->WarpWMCursor with those same corect parameters. Beyond that I am sorta lost. That function is provided by src/video/gp2x/SDL_gp2xvideo.c unless I am mistaken, and it assigns the new coordinates directly into members of the current SDL_VideoDevice, so I can only assume that those newly assigned coordinates are being lost or not read correctly somewhere.
Are you using the latest version of my SDL? SDL_WarpWMCursor() updates both SDL's view of where the cursor is and sets the hardware cursor position directly. I've just tested it and it is working fine (at least setting coordinates via SDL_WarpMouse is putting the cursor where it should.)
 
Last edited by a moderator:
I am using the precompiled version linked in your post, and the sources included in oopo's tarball. If you can direct me to newer ones then I will try them.

I solved the problem temporarily by modifying SDL_WarpMouse to call PrivateMouseMotion (??) instead of SDL_WarpWMCursor.
 
Sparr posted on Aug 7 2006 at 05:00 PM said:
I am using the precompiled version linked in your post, and the sources included in oopo's tarball. If you can direct me to newer ones then I will try them.

I solved the problem temporarily by modifying SDL_WarpMouse to call PrivateMouseMotion (??) instead of SDL_WarpWMCursor.
The link in the first post of HW_SDL thread (http://www.gp32x.de/board/index.php?s=&showtopic=23819&view=findpost&p=324868) is to the latest, the source in oopo's big tarball (the one that doesn't need to download everything sepatately) might be from before I had the mouse working. The latest sourcecode is available via svn, instructions also in first post.
I can't remember how WarpMouse / WarpWMCursor / PrivateMouseMotion etc interact - I'll see if I'm missing anything in regards to events, but if GP2X_WarpWMCursor has these two lines in it
Code:
data->io[MLC_HWC_STX] = x;
data->io[MLC_HWC_STY] = y;
then the cursor should definately move as these set the hardware cursor coordinates directly.
EDIT:
When SDL_WarpMouse() calls WarpWMCursor I should be generating mouse events, which I've not implemented. I'll get right onto that, I probably forgot because the cursor stuff was done before I had access to the mouse and it was a quick hack to just show the cursor.
 
Last edited by a moderator:
I just tried with the latest SVN, still no-go. I am just going to stick to using PrivateMouseMotion for now I guess.
 
hi!

i have the same problem
SDL_WarpMouse sets the cursor to the right position, but when i move the mouse, it jumps back to its previous position

is there another way to set the cursor to a new position?

Sparr posted on Aug 7 2006 at 05:00 PM said:
[...]
I solved the problem temporarily by modifying SDL_WarpMouse to call PrivateMouseMotion (??) instead of SDL_WarpWMCursor.

could you upload a precompiled version of this?

thx
 
Last edited by a moderator:
hmm... i've used another toolchain (don't ask me which one... there are hundreds on my desktop *g*) and again the newest hw sdl and now it seems to work
 
Back
Top