SDL Wiki

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


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.