Are SDL_ShowCursor and SDL_WarpMouse broken in 1.3?

I tried searching these forums as well as Google, but didn’t have any luck regarding this.

Has anyone else experienced any problems with either SDL_ShowCursor or SDL_WarpMouse in 1.3? I can’t get either of them to do anything. Maybe (hopefully) I’m just using them incorrectly?

Development platform is Windows 7 x64.

Thanks.

Well, I guess the question would be: how are you using them?On Sun, Apr 11, 2010 at 8:34 AM, BrianDFS wrote:

I tried searching these forums as well as Google, but didn’t have any
luck regarding this.

Has anyone else experienced any problems with either SDL_ShowCursor or
SDL_WarpMouse in 1.3? I can’t get either of them to do anything. Maybe
(hopefully) I’m just using them incorrectly?

Development platform is Windows 7 x64.

Thanks.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Alex Barry wrote:

Well, I guess the question would be: how are you using them?

After I’ve initialized SDL, I make one call to:

Code:
SDL_ShowCursor( 0 );

In my main loop I call:

Code:
while( SDL_PollEvent( &SDLEvent ) )
{

}
SDL_WarpMouse( WindowWidth >> 1, WindowHeight >> 1 );

That should, in theory, warp the mouse to the bottom right of the screen.
Is that the result you are going for?On Sun, Apr 11, 2010 at 2:15 PM, BrianDFS wrote:

Alex Barry wrote:

Well, I guess the question would be: how are you using them?

After I’ve initialized SDL, I make one call to:

Code:

SDL_ShowCursor( 0 );

In my main loop I call:

Code:

while( SDL_PollEvent( &SDLEvent ) )
{

}
SDL_WarpMouse( WindowWidth >> 1, WindowHeight >> 1 );


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Alex Barry wrote:

That should, in theory, warp the mouse to the bottom right of the screen.? Is that the result you are going for?

Well actually, the middle of the screen. But you get the point in terms of the intended warping. So yes, I intend for the mouse to both be hidden and repeatedly centered on the screen. Neither happen. When stepping through the code, I see no win32 calls to either ShowCursor or SetCursorPos. Both of which I believe, are required on a Windows system to manipulate the mouse cursor as I’m desiring.

Granted I’m complete SDL noob. So again, maybe (hopefully) I’m missing something obvious as far as default SDL API and functionality are concerned. In case I’m not though, I’ve already made the necessary changes locally to do what I need to do.

Well, here is some troubleshooting:

  1. Have you initialized the video mode?
  2. are you getting anything from SDL_GetError()?

Probably seeing more code would be helpfulOn Sun, Apr 11, 2010 at 6:41 PM, BrianDFS wrote:

Alex Barry wrote:

That should, in theory, warp the mouse to the bottom right of the screen.
Is that the result you are going for?

Well actually, the middle of the screen. But you get the point in terms of
the intended warping. So yes, I intend for the mouse to both be hidden and
repeatedly centered on the screen. Neither happen. When stepping through the
code, I see no win32 calls to either ShowCursor or SetCursorPos. Both of
which I believe, are required on a Windows system to manipulate the mouse
cursor as I’m desiring.

Granted I’m complete SDL noob. So again, maybe (hopefully) I’m missing
something obvious as far as default SDL API and functionality are concerned.
In case I’m not though, I’ve already made the necessary changes locally to
do what I need to do.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Alex Barry wrote:

Well, here is some troubleshooting:

  1. Have you initialized the video mode?
  2. are you getting anything from SDL_GetError()?

Probably seeing more code would be helpful

I haven’t been checking SDL_GetError(). I’ll do that though. In the meantime, here is the init code and the update code.

Code:
static DF_BOOL SDLInit()
{
if( SDL_Init( SDL_INIT_VIDEO ) == -1 )
return DF_FALSE;

const SDL_VideoInfo *SDLVideoInfo = SDL_GetVideoInfo();

SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );

SDL_GL_SetAttribute( SDL_GL_RED_SIZE,       8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE,     8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE,      8 );
SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE,     8 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE,     0 );
SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE,   0 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,   1 );

if( SDL_SetVideoMode( 1280, 720, SDLVideoInfo->vfmt->BitsPerPixel, SDL_OPENGL ) == 0 )
    return DF_FALSE;

SDL_WM_GrabInput( SDL_GRAB_ON );

SDL_ShowCursor( 0 );

return DF_TRUE;

}

static DF_VOID SDLUpdate()
{
SDL_Event SDLEvent;

// Grab all the events off the queue.
while( SDL_PollEvent( &SDLEvent ) )
{
    switch( SDLEvent.type )
    {
        case SDL_KEYDOWN:
            DF_InputMgr::SDLKeyDown( SDLEvent.key.keysym.scancode );
            break;

        case SDL_KEYUP:
            DF_InputMgr::SDLKeyUp( SDLEvent.key.keysym.scancode );
            break;
    }
}
SDL_WarpMouse( 1280 >> 1, 720 >> 1 );

}

Yes, they are not implemented yet. They’re on the list as soon as
Ryan refactors the multiple mouse support.

See ya!On Sun, Apr 11, 2010 at 5:34 AM, BrianDFS wrote:

I tried searching these forums as well as Google, but didn’t have any luck
regarding this.

Has anyone else experienced any problems with either SDL_ShowCursor or
SDL_WarpMouse in 1.3? I can’t get either of them to do anything. Maybe
(hopefully) I’m just using them incorrectly?

Development platform is Windows 7 x64.

Thanks.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Sam Lantinga wrote:

Yes, they are not implemented yet. They’re on the list as soon as
Ryan refactors the multiple mouse support.

See ya!

Thanks Sam. That’s all I needed to know.

Sorry for the misinformation, BrianOn Mon, Apr 12, 2010 at 8:25 PM, BrianDFS wrote:

Sam Lantinga wrote:

Yes, they are not implemented yet. They’re on the list as soon as
Ryan refactors the multiple mouse support.

See ya!

Thanks Sam. That’s all I needed to know.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Alex Barry wrote:

Sorry for the misinformation, Brian

Alex, no problem. I’m just glad I’m not going crazy after all! [Wink]

That should, in theory, warp the mouse to the bottom right of the
screen. Is that the result you are going for?

Um, I think that should warp his mouse to the centre of the screen:

SDL_WarpMouse( WindowWidth >> 1, WindowHeight >> 1 );

He divides the width and the height by 2.

ZoltanOn Sun, 11 Apr 2010 18:33:12 -0400 Alex Barry <alex.barry at gmail.com> wrote: