Thursday, April 14, 2016

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

Leave a Comment

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.

1 Answers

Answers 1

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.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment