Does SDL2 provide support for multiple event filters?
Take the following source for example:===============================
#include “SDL.h”
int event_filter(void* unused, SDL_Event* event)
{
if(event->type == SDL_MOUSEBUTTONDOWN)
printf(“Mouse event filter 1\n”);
return 1;
}
int event_filter2(void* unused, SDL_Event* event)
{
if(event->type == SDL_MOUSEBUTTONDOWN)
printf(“Mouse event filter 2\n”);
return 1;
}
int main(int argc, char** argv)
{
SDL_Window* window;
SDL_Event event;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("",0,0,640,480,0);
SDL_SetEventFilter(event_filter,NULL);
SDL_SetEventFilter(event_filter2,NULL);
while( 1 ) {
SDL_PollEvent(&event);
if (event.type == SDL_QUIT) {
SDL_Quit();
return 0;
}
}
}
==================================
It is quite bad, I know, but what it does is set two different
event filters (event_filter
and event_filter2
). However,
when executing the code, when I press the mouse, I only
get output from the event_filter2
which is set last.
Which practically means that currently SDL2 does not support
more than one event filter at a time. Is that true ?? Or at least,
is there any way to add more than one filter??
Thanks in advance,
Aggelos Kolaitis
C is the God’s Programming Language