I'm trying to create a splash screen on startup, but it seems that calling window.display() isn't sufficient to make the contents of the window instantly visible, for some reason. My procedure can be summed up as follows:
- Fill the window with black (using a RectangleShape)
- Load the splash screen into a texture.
- Create a Sprite and draw it centred in the window.
- Call display() on the window.
- Play the sound. (This is the only part that works perfectly.)
- Institute some sort of delay.
- Repeat all the above steps a second time.
I actually have two problems; the main problem is that nothing shows up until the main event loop, by which point the splash screen has been erased; also, I'm unsure how to create the sort of delay where pressing a key ends it prematurely.
I'm not sure what portion of the code would be best to post here. It uses several utility functions, so simply copy-pasting the splash code would probably not be very instructive. The window does get created prior to the splash code, incidentally.
Stepping through the code in the debugger hasn't helped much, although somehow I'm sometimes able to see the second splash screen when I set certain breakpoints and hop between them with F9 (continue). With breakpoints disabled, this never seems to happen.
Any ideas? Or requests for particular parts of the code?