3
votes

In an SDL2 project, SDL_PollEvents( SDL_Event* e ) doesn't send any events, and allways returns 0, so I can't process any events. My event processing loop looks fine :

SDL_Event e;

while( SDL_PollEvent( &e ) > 0 )
{
    //this is never reached !
    printf( "recieved event %d\n", e.type );

    switch(e.type)
    {
        case SDL_QUIT:
            quit = true;
    }
}

On the other hand, it compiles fine, drawing works, and I'm sure it's not stuck in an infinite loop ( I made it print out a message at each frame ).

I link against SDL2 and all other dependencies, I even make gcc/g++ call sdl-config --cflags. How can this be fixed ?

1

1 Answers

0
votes

You shouldn't call sdl-config --cflags. This is for SDL ( the first version of the library ), not SDL2. It somehow conflicts and stops all events from reaching SDL_PollEvents(). Remove it and it should work !