Re: [AD] Possible Timer API additions/modifications

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Jan 26, 2008 1:43 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
On 2008-01-26, Ryan Dickie <goalieca@xxxxxxxxxx> wrote:
> Since allegro is a high-level library I thought it might be useful to add
> some common functionality to the timer API's. In particular it would be
> useful to have a stopwatch timer and a countdown timer. A stopwatch simply
> measures time elapsed. The interface provides for pausing, resuming, and
> resetting. The countdown timer will expire when the time remaining reaches
> 0. It has a nearly identical interface as the stopwatch. The stopwatch and
> countdown timers were done using doubles as they were the natural choice.
> These timers are implemented entirely on top of al_current_time().

I agree with Elias.  These are simple wrappers on top of
al_current_time() so there's no need for them to be in the core.

> /**
> ####################################################
> ########### One-Shot TIMER #########################
> ####################################################
> should be parallel to allegro's periodic timer
> Current Timers have a nice interface I think
> just make it handle doubles.
> */

I have thought about adding a one-shot mode to ALLEGRO_TIMERs.  It would
only insert one one tick event into the event queues it is registered
with, then stop.  I don't know if that's what you're referring to.  It's
not strictly necessary but probably would be quite convenient.

Peter


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers


Yes, that is exactly what I was thinking. It would be nice under certain conditions. Right now the countdown timer is polled and can be periodically checked whereas this would be event based wakeup.

I was just also talking to Elias on irc. I thought it might be possible to make a single timernu.c file which only relies upon al_rest() and al_current_time() and hence become platform independant (with maybe an #ifdef for quirks). It seems right now there is quite a bit of overlap between the windows code and the unix code.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/