sdlPeepEvents function

int sdlPeepEvents(
  1. Pointer<SdlEvent> events,
  2. int numevents,
  3. int action,
  4. int minType,
  5. int maxType,
)

Check the event queue for messages and optionally return them.

action may be any of the following:

  • SDL_ADDEVENT: up to numevents events will be added to the back of the event queue.
  • SDL_PEEKEVENT: numevents events at the front of the event queue, within the specified minimum and maximum type, will be returned to the caller and will not be removed from the queue.
  • SDL_GETEVENT: up to numevents events at the front of the event queue, within the specified minimum and maximum type, will be returned to the caller and will be removed from the queue.

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().

This function is thread-safe.

\param events destination buffer for the retrieved events \param numevents if action is SDL_ADDEVENT, the number of events to add back to the event queue; if action is SDL_PEEKEVENT or SDL_GETEVENT, the maximum number of events to retrieve \param action action to take; see [#action|Remarks] for details \param minType minimum value of the event type to be considered; SDL_FIRSTEVENT is a safe choice \param maxType maximum value of the event type to be considered; SDL_LASTEVENT is a safe choice \returns the number of events actually stored or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_PollEvent \sa SDL_PumpEvents \sa SDL_PushEvent

extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType)

Implementation

int sdlPeepEvents(Pointer<SdlEvent> events, int numevents, int action,
    int minType, int maxType) {
  final sdlPeepEventsLookupFunction = libSdl2.lookupFunction<
      Int32 Function(Pointer<SdlEvent> events, Int32 numevents, Int32 action,
          Uint32 minType, Uint32 maxType),
      int Function(Pointer<SdlEvent> events, int numevents, int action,
          int minType, int maxType)>('SDL_PeepEvents');
  return sdlPeepEventsLookupFunction(
      events, numevents, action, minType, maxType);
}