-next-
Handling Events

When an event occurs (like the user clicking in the window, pressing a key, etc.), an event well be added to SDL's event queue.

You can see if there are any events in the queue using "SDL_PollEvent()":

SDL_Event event;

if (SDL_PollEvent(&event) != 0)
  {
    ... handle the event
  }

Or, you can use "SDL_WaitEvent()" which will only return once there is an actual event (or an error):

SDL_Event event;

SDL_WaitEvent(&event);

... handle the event