[SDL] SDL_WaitEventTimeout
Alan Wolfe
atrix2 at cox.net
Thu Nov 6 11:52:00 PST 2003
Hey Barrett, are you pressing more than 1 key at a time?
if so check this out, and if not check it out too...useful knowledge to have
http://sjbaker.org/steve/omniv/keyboards_are_evil.html
----- Original Message -----
From: <barrett at 9hells.org>
To: <sdl at libsdl.org>
Sent: Thursday, November 06, 2003 11:45 AM
Subject: Re: [SDL] SDL_WaitEventTimeout
> 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
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
More information about the SDL
mailing list