How to flush event queue?

Hi all!

Is there any way to reliably flush the event que in a SDL program?

I encountered a situation where, in a Linux SDL program two
SDL_WaitEvent(&event) calls after the other were sufficient to make the
program pause until the user pressed a key, but this does not work in the
MingW compiled version of the same program under Windows.

SO - I am looking for a way to reliably flush the event queue so that a call
to SDL_WaitEvent(&event) will definitely pause the program and actually
-wait- for an event.

Thanks!–
Stefan Viljoen
Polar Design Solutions
Software Support Technician

Stefan Viljoen wrote:

Hi all!

Is there any way to reliably flush the event que in a SDL program?

I encountered a situation where, in a Linux SDL program two
SDL_WaitEvent(&event) calls after the other were sufficient to make the
program pause until the user pressed a key, but this does not work in the
MingW compiled version of the same program under Windows.

SO - I am looking for a way to reliably flush the event queue so that a call
to SDL_WaitEvent(&event) will definitely pause the program and actually
-wait- for an event.

Thanks!

How about this (probably not efficient):

SDL_Event event;
while(SDL_PollEvent(&event));

Sebastian

instead of making a hack like that (2 events of any kind make it move on as
well, such as mouse movement, app focus lost/gained etc), why not make it
actualy wait for a keydown event?> ----- Original Message -----

From: s.beschke@gmx.de (Sebastian Beschke)
To:
Sent: Wednesday, March 17, 2004 12:06 PM
Subject: Re: [SDL] How to flush event queue?

Stefan Viljoen wrote:

Hi all!

Is there any way to reliably flush the event que in a SDL program?

I encountered a situation where, in a Linux SDL program two
SDL_WaitEvent(&event) calls after the other were sufficient to make the
program pause until the user pressed a key, but this does not work in the
MingW compiled version of the same program under Windows.

SO - I am looking for a way to reliably flush the event queue so that a
call

to SDL_WaitEvent(&event) will definitely pause the program and actually
-wait- for an event.

Thanks!

How about this (probably not efficient):

SDL_Event event;
while(SDL_PollEvent(&event));

Sebastian


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl