SDL_PollEvent

Name

SDL_PollEvent -- Polls for currently pending events.

Synopsis

uses
SDL;

function SDL_PollEvent( event : PSDL_Event ) : Integer;

Description

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 nil, the next  event is removed from the queue and stored in that area.

Examples

event : TSDL_Event; // Event structure

.
.
.
// Check for events
while ( SDL_PollEvent( @event ) ) do
begin // Loop until there are no events left on the queue
case event.type_ of // Process the appropiate event type
SDL_KEYDOWN: // Handle a KEYDOWN event
begin
printf("Oh! Key press\n");
end;

SDL_MOUSEMOTION:
begin
.
.
.
end;
else // Report an unhandled event
printf("I don't know what this event is!\n");
end;
end;

See Also

TSDL_Event , SDL_WaitEvent , SDL_PeepEvents