Less Simple Example
This example is similar, but every time you press a key, it displays a message.event = NONE; do { if ( there_is_an_event_in_the_queue() ) { event = get_next_event(); if (event == KEYPRESS) printf("You pressed a key\n"); } } while (event != QUIT);