Skip to content

Instantly share code, notes, and snippets.

@slime73
Created April 24, 2013 00:33
Show Gist options
  • Save slime73/5448649 to your computer and use it in GitHub Desktop.
Save slime73/5448649 to your computer and use it in GitHub Desktop.
#include <SDL.h>
int PollEvents()
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
return 1;
default:
break;
}
}
return 0;
}
int main(int argc, char *argv[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window *win = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_INPUT_GRABBED);
while (1)
{
if (PollEvents())
break;
}
SDL_DestroyWindow(win);
SDL_Quit();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment