Last active
August 29, 2015 14:03
-
-
Save southwolf/c8974c14d84f565caa52 to your computer and use it in GitHub Desktop.
SDL Event Processing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (!done) | |
{ | |
if (SDL_WaitEvent(&event)) | |
{ | |
switch (event.type) | |
{ | |
case SDL_QUIT: | |
view.interrupt(); | |
decode.interrupt(); | |
done = 1; | |
break; | |
case SDL_WINDOWEVENT: | |
if (event.window.event == SDL_WINDOWEVENT_RESIZED) | |
{ | |
SDL_RenderSetViewport(renderer, NULL); | |
display_rect.w = event.window.data1; | |
display_rect.h = event.window.data2; | |
} | |
if (event.window.event == SDL_WINDOWEVENT_CLOSE) | |
{ | |
view.interrupt(); | |
decode.interrupt(); | |
done = 1; | |
} | |
break; | |
case SDL_KEYDOWN: | |
if ((event.key.keysym.sym == SDLK_ESCAPE) || (event.key.keysym.sym == SDLK_q)) | |
{ | |
// Quit | |
view.interrupt(); | |
decode.interrupt(); | |
done = 1; | |
} | |
break; | |
default: | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment