Use the userdata
parameter to point to your object, and dispatch through a static method to the non-static method:
class ObjectWithState
{
int someState;
public:
int operator()(SDL_Event *event)
{
++someState
}
static int dispatch(void* userdata, SDL_Event* event)
{
return static_cast<ObjectWithState*>(userdata)->operator()(event);
}
};
int main()
{
//boilerplate
ObjectWithState obj;
SDL_SetEventFilter(&ObjectWithState::dispatch, &obj);
}