Images Vanishing After Half Second

I’m making a project in C++ that uses SDL and I’ve made a sprite rendering system. And there is a problem which will most likely have a dumb solution, but the play button and the wimp button appear for a split second then they vanish for some reason. The project has two files: a .cpp file and a .h file, the .cpp file is basically for everything except a few functions and the .h file is for the sprite rendering system.

The .cpp file: // Snooping through the files are we?// Compile With: g++ main.cpp loadImage -
The .h file: // Snooping through the files now aren't you?// Compile With: g++ main.cpp l -

What happens is that you call queueVisualEvents() each frame and that fills up the image slots…

slot 1: main_menu.png
slot 2: play_button.png
slot 3: wimp_button.png
slot 4: main_menu.png
slot 5: play_button.png
slot 6: wimp_button.png
slot 7: main_menu.png
slot 8: play_button.png
slot 9: wimp_button.png
slot 10: main_menu.png

When you have filled up all the 10 slots the last slot will draw the main_menu.png which covers everything else and that is why you don’t see anything.

Unrelated note: SDL_Quit does not terminate the application. It merely shuts down SDL so when you press the X window button the program continues to run even after the window has closed.

Thank you, I didn’t think of this!