1SDL_PollEvent(3)               SDL API Reference              SDL_PollEvent(3)
2
3
4

NAME

6       SDL_PollEvent - Polls for currently pending events.
7

SYNOPSIS

9       #include "SDL.h"
10
11       int SDL_PollEvent(SDL_Event *event);
12

DESCRIPTION

14       Polls  for  currently  pending  events,  and returns 1 if there are any
15       pending events, or 0 if there are none available.
16
17       If event is not NULL, the next event is  removed  from  the  queue  and
18       stored in that area.
19

EXAMPLES

21       SDL_Event event; /* Event structure */
22
23       .
24       .
25       .
26       /* Check for events */
27       while(SDL_PollEvent(&event)){  /* Loop until there are no events left on the queue */
28         switch(event.type){  /* Process the appropiate event type */
29           case SDL_KEYDOWN:  /* Handle a KEYDOWN event */
30             printf("Oh! Key press
31       ");
32             break;
33           case SDL_MOUSEMOTION:
34             .
35             .
36             .
37           default: /* Report an unhandled event */
38             printf("I don't know what this event is!
39       ");
40         }
41       }
42

SEE ALSO

44       SDL_Event, SDL_WaitEvent, SDL_PeepEvents
45
46
47
48SDL                         Tue 11 Sep 2001, 22:59            SDL_PollEvent(3)
Impressum