Mail Archives: djgpp/1997/04/23/12:31:34
Ian D Romanick wrote:
>
> > > You could attempt this by using some form of external counter that
> > > you can refer to each time you flip pages.
> >
> > Yes, I sort of tried this last night- I tried to measure the number
> > of milliseconds that it took to draw one frame.
>
> This is *NOT* the right way to do this. The right way uses a single
> timer interrupt going at whatever your target rate is. Just update your
> position values during the interrupt. You will need to be careful to
> make sure that the position values don't get modified while you're using
> them. Use some type of double buffering...I leave this as an exercise
> for the reader. If your interrupt rate is high enough (perhaps 2x the
> refresh rate of the display mode), this should look OK.
Yes, I see your point exactly! I am using the fixed point-based
trignometric functions of Allegro to calculate the new player position,
but calling them from the ISR shouldn't be a problem since they're
fast..
Now, I understand what you mean by double buffering, but what would
happen if I did not do this? (Assume that I only access the player
coordinates once.) There would be no problem, correct? (Though I
-will- have to implement this double buffering type of thing..)
Thanks for your help! I knew there must be a simple answer. :) I'll
try this as soon as I get home from work...
Tom Grandgent
tgrand AT canvaslink DOT com
Canvas Link, Inc.
- Raw text -