delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/02/20:39:21

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Packed files
Date: Mon, 2 Jun 1997 22:12:47 +0100
Organization: None
Distribution: world
Message-ID: <NWKgBBAPdzkzEwEG@talula.demon.co.uk>
References: <33904169 DOT 5B2C AT pssnet DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 44
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

marshall writes:
>I'm using the grabber.exe that comes with allegro to store some images
>for one of my projects but when I try to load them in the program the
>images and palette don't come across.  I've looked at the examples and
>I've even copied some of the code out of them but still no luck.  Does
>anyone have any code that they could show me?

What's wrong with examples/ex12.c? If you could explain what you don't
understand about this, it will help me to improve it for future users of
the library...

>#define CONSOL1             0       /* (bmp)  */
>#define CONSOL2             1       /* (bmp)  */
>#define CONSOL3             2       /* (bmp)  */
>#define DEFAULT_PAL         3       /* (pal)  */

This is from a file called something like consol.h, right? These are
just convenience names for the objects in your file: once the file has
been read into memory they are accessed by number, but it's nicer to
refer to things like DEFAULT_PAL than to hardcode the number 3 into your
program!

>Are the files in the consol.dat file.

Yup. You need to do something like:

    DATAFILE *data = load_datafile("consol.dat");

after which you can access each object with the syntax:

    data[OBJECT_NUMBER].dat;

Eg. to set the palette from your datafile, you would write:

    set_palette(data[DEFAULT_PAL].dat); 

Then to display one of the images, you could call:

    blit(data[CONSOL1].dat, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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