简体   繁体   中英

I had an issue with SDL_Delay() in MacOS 10.14.6

It seems that the SDL_Delay() has some problem in macOS, instead of that we can use:

bool is_running = true;
SDL_Event event;
while (is_running) {
    while (SDL_PollEvent(&event)) {
        if (event.type == SDL_QUIT) {
            is_running = false;
        }
    }
    SDL_Delay(16);
}

But what should I use when I want my program to stop for 2 seconds.

I found the answer: https://discourse.libsdl.org/t/sdl2-cant-see-the-window/25835

Ok, I found the issue. The window wouldn't show up on OS X unless I had an event loop going (prior I had an SDL_Delay call).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM