I’m picked up a version of Black Shades off Icculus.org’s site in hopes
to get an official OS X release out the door. Unfortunitly I’m finding
a strange bug that I’m having troubles figuring out. Here’s what’s
Black Shades is a first person shooter so obviously it must grab the
cursor movement and apply it to the players character in the game to
allow them to move. Obviously in normal usage on say the desktop the
users cursor is limited to the edges of the screen.
In this version of
Black Shades it seems the cursor is locked as if the user were siting
working in their desktop.
SDL_WM_GrabInput(SDL_GRAB_ON) appears as if it’s in the proper location
(#ifdef FULLSCREEN and I’ve verified that section of code is
executed.), so at this point I’m running out of ideas and I’m hoping
someone with experience might know something I’m forgetting somewhere
(I hear when built in Linux it doesn’t have this problem…?).
I’m not sure what you mean by “locked”, but I believe your problem is
related to the (somewhat) recent changes to the OS X port of SDL. The
input grabbing has been fixed in SDL, so there is no longer any need to
warp the cursor (SDL does this behind the scenes if necessary).
What SDL_WM_GrabInput() is supposed to do (you won’t find this in the
docs is either a) if the cursor is visible, keep the mouse within
the window/screen, or b) if the cursor is invisible, ensure a steady
stream of relative motion events (so FPS games work with minimum
headache). Previously in OS X (and on OS 9 and possibly Linux this is
still broken), neither a nor b worked, so games relied on continuously
warping the cursor to the center of the screen (and skipping the next
If you want to keep the mouse confined to the center and use a hardware
cursor (the cursor is visible), don’t use SDL_WM_GrabInput() - use the
aforementioned warp technique.
If you are drawing your own cursor (e.g. some OpenGL FPS), you may use
SDL_WM_GrabInput() - but in this case don’t use the warping technique.
The general rule is that you should not use both warping and grab input
at the same time - though some games still use this as a hack around
what appears to be a broken or limited implementation on certain
DarrellOn Tuesday, May 6, 2003, at 03:02 PM, sdl-request at libsdl.org wrote:
Date: Mon, 5 May 2003 22:17:15 -0500
From: Derek Arndt
To: sdl at libsdl.org
Reply-To: sdl at libsdl.org