delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/03/11:59:49

To: djgpp AT delorie DOT com
Subject: Re: allegro
References: <OCMb4.65$Va DOT 1217 AT weber DOT videotron DOT net>
From: Michael Bukin <M DOT A DOT Bukin AT inp DOT nsk DOT su>
Date: 03 Jan 2000 18:39:08 +0600
In-Reply-To: "Valkir"'s message of "Sun, 2 Jan 2000 13:18:10 -0500"
Message-ID: <20zounz5w3.fsf@Sky.inp.nsk.su>
Lines: 34
X-Mailer: Gnus v5.5/Emacs 19.34
Reply-To: djgpp AT delorie DOT com

"Valkir" <jfd50 AT videotron DOT ca> writes:

> Hello.
> I have that simple program, just to test the speed of allegro.
> here it is.
> int posX=10;
> void draw_screen(BITMAP *bmp)
> {
>  int x,y;
>  for(x=0;x<800;x++)
>   for(y=0;y<600;y++)
>    putpixel(bmp,x,y,65);

Do you have to use putpixel?  Using rectfill would be considerably
faster.  If you still want to use putpixel, you should nest loop by x
into loop by y coordinate, to avoid bank switching when you go from
one line to the next line.

Using rectfill:

  rectfill (bmp, 0, 0, bmp->w - 1, bmp->h - 1, 65);
  rectfill (bmp, posX, 100, posX + 19, 119, 45);
  posX++;

>    /* set up Allegro */
>    allegro_init();
>    install_keyboard();
>    set_gfx_mode(card, 800,600, 0, 0);
>    set_color_depth(8);

Usually you need to set color depth before setting graphics mode.

-- 
Michael Bukin

- Raw text -


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