delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/02/13:30:03

From: "Valkir" <jfd50 AT videotron DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: allegro
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <OCMb4.65$Va.1217@weber.videotron.net>
Date: Sun, 2 Jan 2000 13:18:10 -0500
NNTP-Posting-Host: 24.200.143.153
X-Complaints-To: abuse AT videotron DOT net
X-Trace: weber.videotron.net 946837038 24.200.143.153 (Sun, 02 Jan 2000 13:17:18 EST)
NNTP-Posting-Date: Sun, 02 Jan 2000 13:17:18 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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);

 for(x=posX;x<posX+20;x++)
  for(y=100;y<120;y++)
   putpixel(bmp,x,y,45);
 posX++;
}

int main(void)
{ 
   BITMAP *bmp;
   int card = GFX_AUTODETECT;

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

   bmp = create_bitmap(SCREEN_W, SCREEN_H);
   while (!keypressed()) {
     draw_screen(bmp);
     vsync();
     blit(bmp, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
   }

   destroy_bitmap(bmp);

   return 0;
}

I just fill the xcreen with 1 color, and add a little square that move 1 pixel each time.
I delete de timer just so it's shorter, but it do only 5-6 fps.

Is there a way for it to be faster or I must use sprite?
thanks, Val



- Raw text -


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