SDL Multiple Window - Quitting Issue
I am attempting to make a Windows program in SDL, which was going alright until I made it a dual-window project (using the SDL_CreateWindow () function, with the SDL_Window object).
Before I did that, the event loop in main () worked like so:
Code:
.
.
.
SDL_Event event;
//While application is running
while (!quit)
{
//Handle events on queue
while (SDL_PollEvent (&event) != 0)
{
//User requests quit
if( event.type == SDL_QUIT )
{
quit = true;
}
.
.
.
Which worked fine - when the user clicks the Close button of the one and only window the program quits properly. As soon as I added another window to the program, neither of the windows' Close buttons had any effect.
I can sort of see the issue here: now there are two windows I'm guessing I have to differentiate between events from one window and the other (and act accordingly) but this is where I come unstuck.
Can anyone please help me out with this?