SDL_PeepEvents

Name

SDL_PeepEvents -- Checks the event queue for messages and optionally returns them.

Synopsis

#include "SDL.h"

int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask);

Description

Checks the event queue for messages and optionally returns them.

If action is SDL_ADDEVENT, up to numevents events will be added to the back of the event queue.

If action is SDL_PEEKEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will not be removed from the queue.

If action is SDL_GETEVENT, up to numevents events at the front of the event queue, matching mask, will be returned and will be removed from the queue.

The mask parameter is a bitwise OR of SDL_EVENTMASK(event_type), for all event types you are interested in

This function is thread-safe.

You may have to call SDL_PumpEvents before calling this function. Otherwise, the events may not be ready to be filtered when you call SDL_PeepEvents.

Examples of mask:

Return Value

This function returns the number of events actually stored, or -1 if there was an error.

See Also

SDL_Event, SDL_PollEvent, SDL_PushEvent, SDL_PumpEvents

SDL_PeepEvents (last edited 2008-04-17 08:18:08 by localhost)