Mail Archives: djgpp/2000/01/03/11:59:49
"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 -