loupus / ffmpeg_tutorial

step by step learn how to code with ffmpeg api
GNU General Public License v3.0
34 stars 11 forks source link

SDL2 does not show any window #2

Closed duwangthefirst closed 3 years ago

duwangthefirst commented 3 years ago

I'm using the latest SDL2 and build the demo on macOS. When it comes to 05_DecodeAndDisplayVideo.cpp, the SDL does not show any window. Finally I find the solution: (the while loop after initSDL should be like this or else no window will show up)

SDL_Event e;
bool quit = false;
while (!quit){

    // original content in while loop

    while (SDL_PollEvent(&e)){
        if (e.type == SDL_QUIT){
            quit = true;
        }
        if (e.type == SDL_KEYDOWN){
            quit = true;
        }
        if (e.type == SDL_MOUSEBUTTONDOWN){
            quit = true;
        }
    }
}
duwangthefirst commented 3 years ago

nice work!