Whenever I move my mouse below where the image renders in my game, the SDL window crashes and closes down.
I have narrowed the crash down to the bit of code where I check to see if the Escape key was pressed and quit my game; the relevant part of my event loop is:
while (SDL_PollEvent(&e))
{
if (e.type == SDL_QUIT)
{
quit = true;
}
if (e.key.keysym.sym == SDLK_ESCAPE)
{
quit = true;
}
}
I found that if I remove the if(e.key.keysym.sym
... check, the crashing stops. What is wrong with my code?