home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!wupost!sdd.hp.com!elroy.jpl.nasa.gov!nntp-server.caltech.edu!godzilla.quotron.com!greg
- From: greg@Quotron.COM (Greg "Maddog" Knauss)
- Newsgroups: comp.sys.atari.st.tech
- Subject: Re: Is page flipping safe, and I need to know about syncing
- Message-ID: <greg.711924194@duke>
- Date: 23 Jul 92 20:43:14 GMT
- References: <Bruq9M.FI7@acsu.buffalo.edu>
- Sender: usenet@godzilla.quotron.com (usenet user)
- Organization: Quotron System, Inc.
- Lines: 44
-
- chu@acsu.buffalo.edu (John C. Chu) writes:
-
- >Is it ok to use Setscreen to do double buffered animation (i.e., draw
- >on one buffer while the other is being displayed and switch. I don't
- >know if I've used the right term for this). By that I mean, does it
- >work on all nominally ST compatible computers, including those with
- >video cards? (Of course, I'd also pay attention to what GEM tells me
- >when I start up so that I reserve enough memory for each screen.)
-
- "Double-buffering" or "page-flipping." And, yep, Setscreen works for
- all standard ST and TT resolutions (though they are different sizes,
- you need to check the resolution and use bigger buffers on the TT).
- I don't know about video cards, but I expect you'd have to use VDI
- calls for them...
-
- >Also, a little while back, someone (Dave Baggett??) was talking about
- >how one should sync one's game to update the screen every n vblanks
- >(where n depends on how much is happening in the program), which will
- >among other things, insure that the game plays at the same speed
- >across variants of ST-type computers. Unfortunately, I wasn't paying
- >attention at the time. How do I do this?
-
- First you decide the maximum number of 1/60 second intervals it will
- take to draw your most complex screen (say 4). Then you write your
- drawing routine so it keep track of how many jiffies have gone by
- since it started to re-draw the screen (between 0 and 4, depending on
- the complexity of the screen). Then you just wait out the remainder.
- If a simple screen takes 1 jiffy to draw, you wait for three. If a
- complex screen takes 3 jiffies to draw, you wait for one. And the
- game runs at the same speed (4 jiffies per refresh) no matter how
- complex it gets.
-
- >After a hiatus, I've decided I'm going to return to trying to program
- >the ST again, so I want to make sure whatever I do will work on as
- >many ST-type computers (i.e., STe, Mega STe, TT, Falcon, unusual
- >configurations of those etc.) as possible (actually, working on all of
- >them would be preferable).
-
- That's the way to do it.
- --
- ------------------------------------------------------------------------------
- Greg "Maddog" Knauss My boss doesn't know I'm doing this,
- greg@duke.quotron.com so I doubt he'd agree with me.
- ------------------------------------------------------------------------------
-