Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

mouse motion event under simulator #26

Open
hamlatzis opened this Issue · 3 comments

2 participants

@hamlatzis

I don't know if I'm doing something wrong or if there is an issue with SDL_MOUSEMOTION event under the simulator. Although I don't think the problem is in my code. I receive SDL_MOUSEBUTTONDOWN & SDL_MOUSEBUTTONUP events but never the SDL_MOUSEMOTION event

Below is a snippet code for my event loop function and I never get the SDL_MOUSEMOTION event:

eventloop()
{
// we'll be using this for event polling
SDL_Event ev;

bool gotEvent = false;

if ( SDL_IsPaused )
{
    SDL_WaitEvent(&ev);
    gotEvent = true;
}
else
    gotEvent = (SDL_PollEvent(&ev) != 0);

while (gotEvent)
{
    fprintf( stderr,"ev.type = %d\n", ev.type );

    switch (ev.type) 
    {
        case SDL_MOUSEBUTTONDOWN:
            {
                fprintf( stderr,"SDL_MOUSEBUTTONDOWN\n" );

                // do something
            }
            break;
        case SDL_MOUSEBUTTONUP:
            {
                fprintf( stderr,"SDL_MOUSEBUTTONUP\n" );

                // do something

                }
            }
            break;
        case SDL_MOUSEMOTION:
            {
                fprintf( stderr,"SDL_MOUSEMOTION\n" );

                // do something

            }
            break;

        // List of keys that have been pressed
        case SDL_KEYDOWN:
        {
            fprintf( stderr,"SDL_KEYDOWN\n" );

            switch (ev.key.keysym.sym)
            {
                // Escape forces us to quit the app
                // this is also sent when the user makes a back gesture
                case SDLK_ESCAPE:
                    ev.type = SDL_QUIT;
                    break;

                default:
                    break;
            }
            break;
        }
        break;

        case SDL_ACTIVEEVENT:
        {
            fprintf( stderr,"SDL_ACTIVEEVENT\n" );

            if (ev.active.state == SDL_APPACTIVE)
            {
                SDL_IsPaused = !ev.active.gain;
            }
        }
        break;

        case SDL_QUIT:
        {
            fprintf( stderr,"SDL_QUIT\n" );

            mbGameRunning = false;
        }
        break; 
    }

    gotEvent = (SDL_PollEvent(&ev) != 0);
}

}

@jnicholl
Collaborator
@hamlatzis

Yes that's correct I keep pressed the left, the right, the wheel and nothing while dragging the mouse. Even without any buttons pressed, just moving the mouse.

Also correct that I'm using the touchcontroloverlay with and without sdl-controls.xml

I've placed the sdl-controls.xml in the assets folder as one large control (full screen):

<?xml version="1.0" encoding="ISO-8859-1"?>


@hamlatzis

I've just built my game for the device (both debug and release versions) and the code runs ok, I do receive mouse move events. So it seams the problem is only in the simulator.

One more thing I've noticed running on the actual hardware, even though I get the mouse motion events for different fingers, the code runs sluggish. So you can't say it can be used for multi touch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.