www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/01/21:22:58.1

From: "Pavlos" <trash24379 AT usa DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bitmap Loading Problem
Date: Sat, 1 May 1999 16:19:17 +0300
Organization: An OTEnet S.A. customer
Lines: 67
Message-ID: <7geuvu$6ks$1@newssrv.otenet.gr>
References: <372ABD26 DOT 5E0A3FC5 AT hotmail DOT com>
NNTP-Posting-Host: dram-a10.otenet.gr
X-Trace: newssrv.otenet.gr 925564734 6812 195.167.113.233 (1 May 1999 13:18:54 GMT)
X-Complaints-To: abuse AT otenet DOT gr
NNTP-Posting-Date: 1 May 1999 13:18:54 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Well, first of all you shouldn't use create_bitmap()
load_bitmap() allocates memory itself
So, here's what you have to do for each .pcx

'loop_start'

buffer=load_bitmap(.....)
blit(...)
free(buffer);

'loop_end'



Denis Lamarche wrote in message <372ABD26 DOT 5E0A3FC5 AT hotmail DOT com>...
>Ok...I've a big problem (but aren't they all).  I mage a myst type game
>that just loads pcx
>files from my hard drive to simulate motion.  Works fine, but if I load
>a pcx into the same
>buffer(BITMAP *buffer) then it stops loading the pcx.  The code below
>should explain it all.
>when the for loop gets to 800(or so) it doesnt load the pcx any more.
>What am I doing wrong?
>Do I have to close the pcx file or something?
>
>
>Denis Lamarche
>
>
>
>#include <stdio.h>
>#include <allegro.h>
>
>BITMAP *buffer;
>PALETTE pal;
>
>int main()
>{
>allegro_init();
>set_gfx_mode(GFX_VGA, 320, 200, 0, 0);
>buffer=create_bitmap(320,200);
>
>for (int i=0;i<10000;i++)
>    {
>    buffer=load_bitmap("c:\\flc\\rm1t10.pcx", pal); //Or any 320x200x256
>pcx file
>    if (buffer==NULL)
>       {
>       textprintf(screen, font, 10, 40, 20, "cannot load pcx at %d
>",i);
>       }
>    else
>       {
>       set_palette(pal);
>       textprintf(buffer, font, 10, 10, 20, "%d ", i);
>       blit(buffer, screen, 0, 0, 0, 0, 320, 200);
>       }
>    }
>
>
>getchar();
>destroy_bitmap(buffer);
>allegro_exit();
>return 69;
>}


- Raw text -


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