Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SDL/SDL.h>
- int main(int argc, char* args[]) {
- int running = 1;
- SDL_Event event;
- SDL_Init(SDL_INIT_EVERYTHING);//ALL TEH TINGS
- freopen("CON","w",stdout);//SDL init redirects stdout and stderr to text files
- freopen("CON","w",stderr);//Return them to console where I want them
- SDL_WM_SetCaption("Hello, World!", NULL);//window title
- SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);//window size
- while (running) {
- SDL_WaitEvent(&event);
- switch (event.type) {
- case SDL_QUIT:
- running = 0;
- break;
- case SDL_KEYDOWN:
- printf("Key press detected\n");
- break;
- case SDL_KEYUP:
- printf("Key release detected\n");
- break;
- default:
- break;
- }//some self explanatory stuff
- }
- SDL_Quit();
- return 0;//obligatory return 0
- }
Advertisement
Add Comment
Please, Sign In to add comment