Mail Archives: djgpp/1997/06/02/20:39:21
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 -