Tao.Sdl SDK Documentation

Sdl.SDL_PollEvent Method 

Polls for currently pending events.

[Visual Basic]
Public Shared Function SDL_PollEvent( _
   ByRef sdlEvent As SDL_Event _
) As Integer
[C#]
public static int SDL_PollEvent(
   out SDL_Event sdlEvent
);

Parameters

sdlEvent

Return Value

Returns 1 if there are any pending events, or 0 if there are none available

Remarks

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.

Binds to C-function in SDL_events.h

int SDL_PollEvent(SDL_Event *event);
            

Example

            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\n");
                    break;
                    case SDL_MOUSEMOTION:
                    .
                    .
                    .
                    default: /* Report an unhandled event */
                    printf("I don't know what this event is!\n");
                }
            }
            

See Also

Sdl Class | Tao.Sdl Namespace | SDL_WaitEvent | Sdl.SDL_Event | SDL_PeepEvents