delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/13/19:03:23

From: "Tony O'Bryan" <aho450s AT nic DOT smsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Datafile --what am I doing wrong?
Date: Wed, 10 Dec 1997 13:14:11 -0600
Organization: Southwest Missouri State University
Lines: 22
Message-ID: <348EEA03.101E@nic.smsu.edu>
References: <348dc5c3 DOT 677781 AT news DOT weldlink DOT com>
Reply-To: aho450s AT nic DOT smsu DOT edu
NNTP-Posting-Host: sara.a09.smsu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Julia/Christopher Webb wrote:

> imgSource=load_datafile("striker.dat");

Did you check imgSource for a NULL value, indicating load failure?

if ( (imgSource = load_datafile("striker.dat")) == NULL)
	ErrorRoutine();

> When I inspect bmp, it has the value NULL.  Is there something I
> overlooked?  The load_datafile is called before the graphics mode is
> set -- I'm using a 640x480x15bit mode.  Is there something I
> overlooked, or should I have set the mode first?

You don't have to set the graphics mode before loading the datafile, but
you -do- have to initialize Allegro:

if (allegro_init() != 0)
	ErrorRoutine();

Also check the return value of all your Allegro calls.  If they fail,
there's no reason for your program to continue.

- Raw text -


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