delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/22/14:31:22

From: "Elias Pschernig" <f DOT x DOT gruber-museum-arnsdorf AT magnet DOT at>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: allegro - sprites and the data file
Date: Fri, 22 May 1998 18:45:54 +0200
Organization: magnet Internet Services
Lines: 50
Message-ID: <6k4dpn$a46$1@orudios.magnet.at>
References: <35613fc6 DOT 90806242 AT news DOT dnai DOT com>
NNTP-Posting-Host: 195.3.67.133
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

david c. yang wrote in message <35613fc6 DOT 90806242 AT news DOT dnai DOT com>...
>hi, i am new to allegro and thus the following questions are very
>basic, but i would be very appreciative if someone would lend me a
>hand:
>
>after drawing an 8 bit sprite in photoshop, i save it as a pcx and
>read it in grabber, grabbing both an rle_sprite and a 8 bit palette
>from the file.  i use the palette and sprite in my program, and it
>displays fine, however, when i grab a new 8 bit rle_sprite, that
>although not using any colors not in the palette (obtained from the
>first bitmap), it displays with messed up colors.
>
>i guess i need to know how to make all the sprites use the same
>palette, and not just the same colors... and also, my sprites
>currently display as an entire box - the docs (yes, i've read them
>:-)) indicate that masked areas are to be of color 0 in the index.
>does this mean that i should put some random color i never intend to
>use in my program into the 0 position, and color in the masked areas
>with it?
>
>obvious i have little idea what i am talking about, but i'd like to
>think that that's because i just started fooling around with allegro a
>few days ago. :-)  i suspect i'm doing this whole palette/sprite
>editing thing the wrong way, so if someone can tell me a better way to
>do it, i'd really appreciate it.  thanks!

I do it the following way:

first, i just always grab 24bit images.
in allegro,
1) i first switch to 8bit grafix mode
2) and load my favorite 256color-palette
3) then, i set color 0 to pink:
RGB c={255,0,255};
set_color(0,c)
4) then, i load all the 24 bit bitmaps

5) now, if you want, restore color 0

this way, i have 8bit images, and all use the
right palette;
transparent is everything that had
color {255,0,255} in 24bit

i'm sure there's a better way however...

hth,
Elias Pschernig


- Raw text -


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