I have a menu system with four screens and six buttons. I have created a button class and it works great. I even have events for the buttons working. The problem is that I have to run the events inside the game loop. This causes me to wait on a menu screen. Is there a way with SDL and c++ to wait until an even fires aside from setting a variable on button click and waiting in a while loop?
SDL allows you to wait for an event with... SDL_WaitEvent. (That's one of the first results if you search for "SDL wait event".) However, it's not exactly clear what your problem is, since running inside a while loop is the standard procedure for games. So it's also not clear that SDL_WaitEvent is the solution to your issue.
When implementing a GUI in a game the usual method is to have the main loop collect the events, and then you send the events to the GUI to be handled. So for example, you might wait for a