SDL_PollEvent - Man Page

Polls for currently pending events.


#include "SDL.h"

int SDL_PollEvent(SDL_Event *event);


Polls for currently pending events, and returns 1 if there are any pending events, or 0 if there are none available.

If event is not NULL, the next event is removed from the queue and stored in that area.


SDL_Event event; /* Event structure */

/* Check for events */
while(SDL_PollEvent(&event)){  /* Loop until there are no events left on the queue */
  switch(event.type){  /* Process the appropiate event type */
    case SDL_KEYDOWN:  /* Handle a KEYDOWN event */         
      printf("Oh! Key press
    default: /* Report an unhandled event */
      printf("I don't know what this event is!

See Also

SDL_Event, SDL_WaitEvent, SDL_PeepEvents

Referenced By

SDL_Event(3), SDL_PeepEvents(3), SDL_PumpEvents(3), SDL_PushEvent(3), SDL_WaitEvent(3).

Tue 11 Sep 2001, 22:59 SDL API Reference