www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/20/03:16:43

From: "Leaphe" <leaphe AT softhome DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro and blitting to screen
Date: Mon, 20 Jul 1998 01:09:08 -0600
Organization: AT&T WorldNet Services
Lines: 40
Message-ID: <6ouqa2$s2b@bgtnsc02.worldnet.att.net>
References: <6onnuh$12p$2 AT oravannahka DOT Helsinki DOT FI>
NNTP-Posting-Host: 12.67.33.214
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

What you have to do is one of the ways showed in the Allegro demo called
dirty rectangles.  It's pretty efficient when I've been able to use it, what
you do is you have a buffer the same size of the screen (like in double
buffering), but when you draw something to the buffer, keep a running tab
(link list?) of what you've drawn, that way when you copy it, you'll just
have to copy what has actually changed instead of the entire thing every
time.  The only downside to this if you're having it scroll, this still will
be the same as copying it, except it will be slower (unless you do some
fancy tricks to merge rectangles), because you'll have to draw regions twice
instead of once.  For scrolling I would suggest doing it in 320x200 mode, if
you do double buffer, it's still pretty fast, and if you want to do tricky
stuff, do a mode-x 320x200, with your virtual pages 640x400, then you will
be able to have 2x2 pages, so lets say you have two screens, and then you
have two pages for that, then you can draw on one, flip it slightly offset,
so it will scroll, be smooth, and still give you a decent frame rate.

--
- Steve
http://home.att.net/~pattonl
Tuomo A Turunen wrote in message <6onnuh$12p$2 AT oravannahka DOT Helsinki DOT FI>...
>HELP !!??
>I'm programming a very nice game with DJGPP and allegro. I use SVGA
>640*480*256 colors, so graphic looks good. But the problem is the
>double buffering. It's just too slow. Example :
>
>  BITMAP *buffer = create_bitmap(640, 480);
>
>  clear(buffer);
>  while( game_continues) {
>    // some drawwing on the buffer
>    blit(buffer, screen, 0, 0, 0, 0, 640, 480);
>  }
>
>That is a the only way I can think of, but itsn't fast enough.
>So is there any faster way to do that 'blit(buffer, screen, ...)' ???
>
>Tuomo Turunen
>


- Raw text -


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