delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/14/14:19:03

From: Roberto Henriquez Laurent <shl24634 AT alumnos DOT inf-cr DOT uclm DOT es>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Memory/background bitmap: Allegro
Date: Fri, 13 Jun 1997 10:06:27 +0200
Organization: Universidad de Castilla-La Mancha
Lines: 33
Message-ID: <33A0FF83.9E17DAB7@alumnos.inf-cr.uclm.es>
References: <5npug2$j61 AT news DOT interlog DOT com>
NNTP-Posting-Host: est271.mag-cr.uclm.es
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> 
> Hi,
> Ok, in my game, I'm using 640x480, and it's a tile based game.  What I want,
> is to have the tiles in the background remain permanent, while the player's
> sprite moves around.  Right now, I'm double buffering, and blitting
> EVERYTHING!  I'm assuming this is a slow and in efficient method.
> Is there a faster (and a less complex) method of doing such a thing?
> 
> I just want the background bitmap to be permanent, and not change (Unless
> I tell it to).

	Before you start using a background, draw it to memory. It will be your
"original" background, which will remain unaltered.
	Have another buffer to draw each frame, there you first copy the
original background and then draw the sprites on it. And after that,
copy all to screen.
	
	Another method would be to save the area covered by each sprite, and
restore it every time before the sprite is redrawn. So you wouldn't have
to dump a complete screen (the background) every time to a work area,
instead you alter and restore the original background each frame. And
once all sprites are drawn, you dump the work area to screen.
	
	This can also be done by writing directly to VGA memory between screen
updates, i.e., while the retrace is not in the visible area of the
screen. But then you have to be real fast... It's not too efficient
since VGA writes are slower than RAM writes.
	
	Hope this helps a little...

	Roberto.
	shl24634 AT alumnos DOT inf-cr DOT uclm DOT es

- Raw text -


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