Alpha in the same background??
Posted: Sat Nov 21, 2009 2:15 am
Hi, it's me again :S. It's coding weekend so I hope to find some of the Gurus .
I was able to draw my isometric tiles in background 1, but now I have another problem, if I set a transparent color, in this case #00FFFF - RGB15(0, 31, 31) - this transaprency shows background 0, but what I want is to show the tile behind, here's te code:
Is there a way to achieve this or will I have to use PaLib :S?? Hehe, just kiding, is there a way, or will I have to do it pixel by pixel :S???
This is the image:
http://mmabj.blogsome.com/images/bug3.jpg
I was able to draw my isometric tiles in background 1, but now I have another problem, if I set a transparent color, in this case #00FFFF - RGB15(0, 31, 31) - this transaprency shows background 0, but what I want is to show the tile behind, here's te code:
Code: Select all
void drawBg32x32Iso(int *tilePos, int tile, int offSet){
if(*tilePos % 32 == 0 && *tilePos != 0) *tilePos += 96;
*(BG_MAP_RAM(0) + *tilePos + 32 * offSet) = tile;
*(BG_MAP_RAM(0) + *tilePos + 1 + 32 * offSet) = tile + 1;
*(BG_MAP_RAM(0) + *tilePos + 2 + 32 * offSet) = tile + 2;
*(BG_MAP_RAM(0) + *tilePos + 3 + 32 * offSet) = tile + 3;
*(BG_MAP_RAM(0) + *tilePos + 32 + 32 * offSet) = tile + 4;
*(BG_MAP_RAM(0) + *tilePos + 33 + 32 * offSet) = tile + 5;
*(BG_MAP_RAM(0) + *tilePos + 34 + 32 * offSet) = tile + 6;
*(BG_MAP_RAM(0) + *tilePos + 35 + 32 * offSet) = tile + 7;
*(BG_MAP_RAM(0) + *tilePos + 64 + 32 * offSet) = tile + 8;
*(BG_MAP_RAM(0) + *tilePos + 65 + 32 * offSet) = tile + 9;
*(BG_MAP_RAM(0) + *tilePos + 66 + 32 * offSet) = tile + 10;
*(BG_MAP_RAM(0) + *tilePos + 67 + 32 * offSet) = tile + 11;
*(BG_MAP_RAM(0) + *tilePos + 96 + 32 * offSet) = tile + 12;
*(BG_MAP_RAM(0) + *tilePos + 97 + 32 * offSet) = tile + 13;
*(BG_MAP_RAM(0) + *tilePos + 98 + 32 * offSet) = tile + 14;
*(BG_MAP_RAM(0) + *tilePos + 99 + 32 * offSet) = tile + 15;
*tilePos += 2;
}
...
dmaCopy(tilesPal, BG_PALETTE, tilesPalLen);
dmaCopy(tilesTiles, bgGetGfxPtr(bgTiles16x12), tilesTilesLen);
int tilePos;
int tile;
tilePos = 0;
drawBg32x32Iso(&tilePos, 0, 0);
drawBg32x32Iso(&tilePos, 16, 1);
drawBg32x32Iso(&tilePos, 0, 2);
drawBg32x32Iso(&tilePos, 16, 3);
drawBg32x32Iso(&tilePos, 0, 4);
drawBg32x32Iso(&tilePos, 16, 5);
int row;
int col;
for(row = 0; row < SCREEN_HEIGHT; row++)
for(col = 0; col < SCREEN_WIDTH; col++)
*(bgGetGfxPtr(bgMain256x256) + col + (row * SCREEN_WIDTH)) = RGB15(0, 0, 31) | BIT(15);
This is the image:
http://mmabj.blogsome.com/images/bug3.jpg