I have a general function that is supposed to handle any event in the SDL event queue. So far, the function looks like this:
int eventhandler(void* args){
cout << "Eventhandler started.
";
while (!quit){
while (SDL_PollEvent(&event)){
cout << "Got event to handle: " << event.type << "
";
switch (event.type){
SDL_KEYDOWN:
keyDownHandler(event.key.keysym.sym);
break;
default:
break;
}
}
}
}
However, when I test the function, I get a whole bunch of events but none of them seem to have a type. It doesn t even print 0 or anything — just nothing. The output when pressing any key looks like this:
Got event to handle:
And nothing else. Any tutorial and the SDL docs say that I should handle events like this, but it isn t working. Anybody else have this problem or a solution?
By the way, the eventhandler runs in an SDL_Thread, but I don t think that s the problem.