#19700 - CyberSlag5k - Fri Apr 23, 2004 6:03 pm
Ok, I know there have been a ton of posts on the subject (and I do believe I've read them all), but something still isn't clicking. Let me lay down what (I think) I know:
Palette index 0 is always transparent. So, if you want a cetain area of your sprite to be transparent, you set it to palette index 0. Sound good?
Ok, so my palette looks like this:
const u16 palettePalette[] = {
0x0000 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x0842, 0x0842,......};
So index 0 is 0x0000. Now I as I understand it, this does not mean that all instances of the color 0x0000 (black) will be transparent. Good, I wouldn't want them to be.
Now, I saw this post on gamedev:
Sounds good to me, although I've never seen anything similar anywhere else. Anyway, if this is the case, all I should have to do is replace all the 0xFFFF's (the color white) in my sprite (not the palette) to 0x0000 (index 0) all the white elements turn transparent. Is this right? Somehow this doesn't seem right to me. I'm quite confused.
_________________
When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...
Palette index 0 is always transparent. So, if you want a cetain area of your sprite to be transparent, you set it to palette index 0. Sound good?
Ok, so my palette looks like this:
const u16 palettePalette[] = {
0x0000 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7FFF, 0x0842, 0x0842,......};
So index 0 is 0x0000. Now I as I understand it, this does not mean that all instances of the color 0x0000 (black) will be transparent. Good, I wouldn't want them to be.
Now, I saw this post on gamedev:
Quote: |
The origin of those color values is this: 0x1F1F: 1F is hex for 31. That means that the pixel is palette index #31. The GBA will look through the palette array for index 31, and use whatever color is there. You'll notice that there are two 1Fs, that's because each number stores two pixels. If you ever try to write your own converter, its important to know that they're reversed. If you had the number: 0x1FFF, the FIRST pixel is FF, or color 255. The SECOND is 1F, or 31. |
Sounds good to me, although I've never seen anything similar anywhere else. Anyway, if this is the case, all I should have to do is replace all the 0xFFFF's (the color white) in my sprite (not the palette) to 0x0000 (index 0) all the white elements turn transparent. Is this right? Somehow this doesn't seem right to me. I'm quite confused.
_________________
When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...