www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/23/12:31:34

Message-Id: <335E3799.47A@canvaslink.com>
Date: Wed, 23 Apr 1997 12:23:54 -0400
From: Tom Grandgent <tgrand AT canvaslink DOT com>
Reply-To: tgrand AT canvaslink DOT com
Organization: Canvas Link, Inc.
Mime-Version: 1.0
To: Ian D Romanick <idr AT cs DOT pdx DOT edu>
Cc: djgpp AT delorie DOT com
Subject: Re: Measuring frame rate more often
References: <199704231559 DOT IAA24835 AT xavier DOT cs DOT pdx DOT edu>

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019