www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/01/14:10:27

Message-ID: <372ABD26.5E0A3FC5@hotmail.com>
From: Denis Lamarche <brainwav AT hotmail DOT com>
Organization: @Home Network
X-Mailer: Mozilla 4.05 [en]C-AtHome0404 (Win95; U)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Bitmap Loading Problem
Lines: 50
Date: Sat, 01 May 1999 05:41:39 GMT
NNTP-Posting-Host: 24.112.228.171
X-Complaints-To: abuse AT home DOT net
X-Trace: news1.rdc1.on.wave.home.com 925537299 24.112.228.171 (Fri, 30 Apr 1999 22:41:39 PDT)
NNTP-Posting-Date: Fri, 30 Apr 1999 22:41:39 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie 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