From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro --> virtual framerate Date: Mon, 4 Aug 1997 19:18:35 +0100 Organization: None Distribution: world Message-ID: References: <33E4E107 DOT 92461C57 AT flex DOT net> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 27 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Marcus D. Brenneman writes: >I think this revolves around a concept I call virtual framerate; the >engine updates the positions of everything, etc. at the same rate of >the highest possible framerate but only draws the frames it can. I want >to do this with my game and I'm not sure how to approach it. You are thinking along the right lines here. Using Allegro, set up a timer handler going at your fixed framerate, say 60 fps, and use it to increment a global variable (eg. mycounter), which you initialise to zero. Then write a control loop like: do { while (mycounter > 0) { move_objects(); mycounter--; } redraw_screen(); } while (!game_over); It's that easy! -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.