SDL_EventFilter

A function definition to be used with SDL_AddEventWatch

Syntax

int (*SDL_EventFilter)(void *userdata, SDL_Event *event);

Definition Parameters

userdata

The data passed by the original call to SDL_AddEventWatch

event

The SDL_Event representing the event

Remarks

WARNING: Be very careful of what you do in this function, as it may run in a different thread!

This function's return value is ignored

Note: this callback is called for events posted by the user through SDL_PushEvent(), but not for disabled events, nor for events by a filter callback set with SDL_SetEventFilter(), nor for events posted by the user through SDL_PeepEvents().

Code Examples

int MyEventFunction(void *userdata, SDL_Event *event) {
    // Do things with userdata and event

    return 0; // Value will be ignored
}

// ...
SDL_AddEventWatch(MyEventFunction, NULL);

Version

This function is available since SDL 2.0.0.

SDL_AddEventWatch
SDL_DelEventWatch
SDL_SetEventFilter

CategoryAPI, CategoryEvents