>
> On 17 Jul 2009, at 19:33, andrei_c wrote:
> > void Canvas::timer_cb(void *v)
> > {
> >   Canvas *c = (Canvas *) v;
> >   c->redraw();
> >   Fl::repeat_timeout(0.5,timer_cb,c); // 0.5 s delay
> >   n_frames++;
> >
> >   if(n_frames > 10) // this should stop the animation but it doesn't
> >     Fl::remove_timeout(timer_cb);
> > }
>
> Rather than calling Fl::remove_timeout() here, it would be better
> (and simpler!) to just *not* call Fl::repeat_timeout(0.5,timer_cb,c);
> above it...
>
> Each timer only fires one time, so if you do not call
> Fl::repeat_timeout(...), the animation should stop.
>
> --
> Ian
>

Hi Ian! What you say makes complete sense, I wonder why I didn't thought of 
that :).
But besides that, what I am doing to implement an animation isn't that bad, 
right??Because I also saw another way of doing it on a FLTK tutorial, it was 
that one whit the 3 JPEGs animation.Unfortunately, that didn't help me, so the 
method above is from my head.Maybe it's not the best.Just asking.
Thanks for your time.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to