Fullscreen cursor grabbing "issues"?

Hey,
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
wrong…

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…?).

Thanks in advanced,
Derek
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: text/enriched
Size: 985 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20030505/7f73a0ce/attachment.bin

yeah what you do is read the mouse position on mouse move events, figure out how far it is from the center on X and Y and rotate the perspective or whatever accordingly, then use SDL_WarpMouse (i think thats the function) to put the mouse back in the middle of the screen.----- Original Message -----
From: Derek Arndt
To: sdl at libsdl.org
Sent: Monday, May 05, 2003 8:17 PM
Subject: [SDL] Fullscreen cursor grabbing “issues”?

Hey,
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 wrong…

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…?).

Thanks in advanced,
Derek

Message: 5
Subject:

–Apple-Mail-2-869391164
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed

Hey,
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
wrong…

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 :wink: 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
motion event).

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
platforms.

HTH,
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