www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/12/17:36:48

From: chris DOT wright AT NOSPAM DOT dial DOT pipex DOT com (Chris)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need help on bmp routine
Date: Fri, 12 Feb 1999 22:15:21 GMT
Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom)
Lines: 28
Message-ID: <36c4a76b.15102783@news.dial.pipex.com>
References: <36C48DE6 DOT 3C641099 AT jupe DOT net>
NNTP-Posting-Host: userp495.uk.uudial.com
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Fri, 12 Feb 1999 12:24:11 -0800, James <james5 AT jupe DOT net> wrote:

>Hi all. I'm trying to write some simple (though difficult for me)
>graphic routines dealing with the use of a bmp to help me learn and I've
>written one program that moves the bmp file up, down, left or right
>depending on which arrow key is pressed then exiting with the esc key.
>The problem is that there is too much flicker and was wondering how to
>write it so that there is less flicker. I'm using DJGPP with Allegro and
>using:
>
>if (key[KEY_LEFT]) x--;
>if (key[KEY_RIGHT]) x++;
>if (key[KEY_UP]) y--;
>if (key[KEY_DOWN]) y++;
>
>to move the image then I clear(screen) and blit the bmp to the new spot.
>This seems to be the cause of all the flickering. I'd like a better way
>to do this but am not sure how. Thanks for any help that anyone can
>give.
>

You need to do all your drawing onto a previously created bitmap (NOT
the screen), then when all your drawing is done, blit that bitmap to
the screen. The flickering you are seeing is the screen being updated
half way through a vertical retrace period, using the method I've
described the screen will only be redrawn once per refresh.

Chris.

- Raw text -


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