简体   繁体   中英

How to ensure an SDL2 fullscreen window is ready with Python (pysdl2)?

When generating a new fullscreen window, vis-a-vis:

sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO)
window = sdl2.ext.Window('win_name', (x_size, y_size), (0, 0), <<flags>>)

If I begin loading resources, or blitting to the graphics buffer immediately, the window may or may not be ready; the time this takes seems entirely contingent on the interim processing overhead.

Is there a callback or some means of knowing that the screen is fully ready? I've gone through the pysdl2 docs and found nothing promising, but I get lost in the sdl2 docs pretty quickly because I'm not a C programmer.

No, there is no callback to know if the windows is ready because there is no need for it.

When the sdl2.ext.Window() returns, you're guaranteed that the window itself is ready.

However, graphics that you put in that window might not be ready and in that case, you should load graphics and call window.show() after it has been loaded.

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