[SDL] SDL_WaitEvent() with expiration

Paul Braman aeon at tampabay.rr.com
Mon Jan 10 03:45:21 PST 2000


On Sun, 9 Jan 2000, Sam Lantinga wrote:

> There isn't yet.  Would it be helpful?  It would essentially be your 
> sample implementation.

In Bill Kendrick's tutorial he advocates something like...

	while (!done)
		start_cycle = SDL_GetTicks()
		poll_events
		handle_events
		if ((SDL_GetTicks() - start_cycle) < animation_interval)
			SDL_Delay(several_milliseconds)

...so that, if you need to at least do animation every 50 milliseconds it
will be in a delay until the next animation cycle if nothing major has
happened in the program.

I was thinking it would be more useful to be waiting for events during
this period to increase interactivity in the program.


Paul Braman
aeon at tampabay.rr.com




More information about the SDL mailing list