Re: [AD] exsprite update

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


On Fri, 2005-02-04 at 17:04 -0800, Chris wrote:
> Elias Pschernig wrote:
> > +   /* waits for vertical retrace interrupt, and at least 40 ms */
> > +   rest(40);
> 
> You don't use rest to time the program. We tell people this all the time 
> on allegro.cc. :) You should set up a timer or use retrace count...
> 
> int old_retrace = retrace_count;
> vsync();
> blit(...);
> while(old_retrace == retrace_count)
>     ;
> 

Well, I think, for this example, it wouldn't really matter, but I
changed it to using a timer interrupt and this:

-   /* waits for vertical retrace interrupt */
-   vsync();
-   vsync();
+   /* Wait for animation timer. */
+   while (frame > ticks) {
+       rest(33);
+   }
+   frame++;

-- 
Elias Pschernig





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