Mail Archives: djgpp/1997/11/29/21:02:43
Funkdog32 <funkdog32 AT aol DOT com> wrote in article
<19971128165900 DOT LAA28332 AT ladder01 DOT news DOT aol DOT com>...
> I need help on how to get a palette from a datafile and make it the
palette
> used to draw in the program
>
Are you referring to the Allegro Library?
If you are then when you use the load_datafile, it is automatically loaded
and you can reference it using the header file created for
that datafile, and just use that index.
otherwise, it is really up to you. I suggest reading from a file into an
array, then using that from then on. (of course, you
should load it into the VGA regs by doing
struct PALETTE
{
char r;
char g;
char b;
} pal[256];
outportb ( 0x3C8, 0 ); // that will index the first color
for ( int a = 0 ; a < 256 ; a++ )
{
outportb (0x3C9, pal[a].r );
outportb ( 0x3C9, pal[a].g );
outportb ( 0x3C9, pal[a].b );
}
of course I don't recommend doing that if you are using the Allegro
graphics routine, because it will give you false results when you "grab" a
palette.
- Raw text -