From: "Angelo Mottola" Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro and blitting to screen Date: Sat, 18 Jul 1998 10:29:12 +0200 Organization: Customer of Flashnet S.p.A. - http://www.flashnet.it Lines: 35 Message-ID: References: <6onnuh$12p$2 AT oravannahka DOT Helsinki DOT FI> NNTP-Posting-Host: ip001.pool-16.flashnet.it To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >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. >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, ...)' ??? Right, so you think double-buffering is too slow in hi-res... TRUE!! I've begun to code with DJGPP and Allegro just about two weeks ago, but I've already a lot of experiences in game programming (visit my page!); I've done a few experiments in SVGA 640x480x65K colors... I wanted to achieve a decent scrolling engine, but the problem was double buffering... Blitting to the screen a bitmap as large as the screen itself requires about 5 or 10 bank switchings depending if you are in 640x480x256 or 640x480x65K mode. For the scroll I used to make a memory bitmap 4x4 screens wide, and then to blit to the screen only the visible portion of it, passing to the blit() function the x and y offset where to begin to copy data from the memory bitmap. This is pretty fast even in 65K hires mode! If you're going to move some sprites (you'll surely need this in a game!), I strongly suggest you to use the dirty blocks method: before drawing every sprite, just get their background blocks, then put them onto the memory bitmap. Blit this large bitmap to the screen just like you want, then to move the sprites, before moving them, draw back their backgrounds on the memory bitmap. Well, now you can move your sprites and repeat the process as you want. Using this method you can achieve a fast animation, even if it's a bit more difficult to code. Remember: double buffering is a great techinque, but it's fast enough only in low-res video modes... I think you already experienced that! Hope this will help you! bye