delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/22:35:55

To: djgpp AT delorie DOT com
Subject: Re: Tile based scrolling?
Message-ID: <19970120.191505.4983.2.chambersb@juno.com>
References: <5bjnrh$bu2 AT dailyplanet DOT wam DOT umd DOT edu>
<01bc0405$868f0a00$20d6b5cf AT default> <5bus5e$308i AT elmo DOT cadvision DOT com>
<32E3DEBE DOT 1A43 AT synapse DOT net>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Mon, 20 Jan 1997 22:15:37 EST

On Mon, 20 Jan 1997 13:08:14 -0800 William Lachance <billl AT synapse DOT net>
writes:
>frenchc wrote:
>On a pentium, it doesn't make much difference (it'll probably run at
>refresh either way) but if you want to include slower machines (and
>your in-game objects aren't very big, or too numerous) dirty 
>rectangles
>are probably the way to go. 

The speed improvements come from only updating part of the screen.
If you are completely redrawing the whole screen every time, don't use
dirty rectangles.  On the other hand, you could do this:
(Note: For my purposes, a sprite is a movable on-screen object {Far as I
know, that's what it is for any purpose, but I thought I should make it
clear}):

Draw all tiles to Backup
Copy Backup to Work
LoopTop
Mark Current rectangles of sprites.
Copy marked areas from Backup to Work.
Update logic (move objects, get input, et cetera).
Move objects
Draw new positions on Work.
Blit Work to screen.
Jump to LoopTop

This has the advantage of both Dirty Rectangles for speed, and double
buffering to avoid flicker.

...Chambers

- Raw text -


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