[SDL] SDL_WaitEventTimeout
barrett at 9hells.org
barrett at 9hells.org
Thu Nov 6 11:46:01 PST 2003
On Thu, Nov 06, 2003 at 04:51:40PM -0200, barrett at 9hells.org wrote:
> In my main loop, I do SDL_PollEvent(), and in case there's no event,
> I do a SDL_Delay(1), just to prevent unecessary 100% CPU usage.
> To my surprise, SDL is missing some keys! That shouldn't happen,
> event if my event loop is not well designed, and is lagging to
> catch the events, because (I think) there is an event queue (buffer),
> right? If I remove the SDL_Delay(), this doesn't happen.
now it gets worse. i reduced the loop to this:
while(1) {
SDL_Event event;
if(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT)
break;
if(event.type == SDL_KEYDOWN) {
int k = event.key.keysym.sym;
printf("keydown %d (%c)\n",
k, isprint(k) ? k : '.');
}
}
}
and it still missing keys sometimes!
how can this happen?
regards,
barrett
More information about the SDL
mailing list