delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/06/22:21:21

From: "Todorovic" <todorus AT eunet DOT yu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro
Date: Thu, 6 Jan 2000 23:44:42 +0100
Organization: Public news server of EUnet Yugoslavia
Lines: 33
Message-ID: <853d02$cbh$3@SOLAIR2.EUnet.yu>
References: <OCMb4.65$Va DOT 1217 AT weber DOT videotron DOT net> <NESb4.536$Va DOT 12631 AT weber DOT videotron DOT net>
NNTP-Posting-Host: p-4.53.eunet.yu
X-Trace: SOLAIR2.EUnet.yu 947205954 12657 213.240.4.53 (7 Jan 2000 00:45:54 GMT)
X-Complaints-To: abuse AT EUnet DOT yu
NNTP-Posting-Date: 7 Jan 2000 00:45:54 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> Well that's not exactly what I mean.
> The real purpose behind this is I want to draw a square
> ( it will be 20 X 20 bmp 20X20 so 400 by 400)
> each bmp will have a height, a design number, if there's an object on it
or
> not...
> so lots of calculation and drawing so I need it to be fast.
>
> would there be a faster way? cause I can't use only 5 fps and with all the
> object, it will be like 2 or 3!

This could give you some idea:

struct OBJECT {
 int x, y; // Position on screen
 BITMAP *objbmp; // Bitmap for this object
} object[20][20];

void draw_screen(BITMAP *bmp)
{
 int i, j;
 blit(background_bmp, bmp, 0, 0, 0, 0, SCREEN_W, SCREEN_H);

 for (i = 0; i < 20; i++)
  for (j = 0; j < 20; j++)
   blit(object[i][j].bmp, bmp, 0, 0, object[i][j].x, object[i][j].y,
        object[i][j].objbmp->w, object[i][j].objbmp->h);
}

Alexa



- Raw text -


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