#145924 - FireSlash - Sun Nov 25, 2007 7:02 pm
Ok, here's my conundrum. I've initialized a font based on the rotscale_text example. Works great.
But I'm already using BG3 for some other graphics, so I switched it over to BG2
However, if I use either one at the same time, bad things(tm) happen.
Here's the font code:
And here's how I'm copying data to BG3:
I think the problem here is BG_GFX_SUB really doesn't tell the code WHICH exrot background to put it on. Both code segments work, just not at the same time. I've seen this method of moving data to the screen used in a lot of examples, but none of them deal with using BOTH backgrounds in mode 5.
_________________
FireSlash.net
But I'm already using BG3 for some other graphics, so I switched it over to BG2
However, if I use either one at the same time, bad things(tm) happen.
Here's the font code:
Code: |
// Setup our 2d font
unsigned int i; const int char_base = 0; const int screen_base = 20; //tex2d subFont; //subFont.loadTex("/data/pi/textures/BG2_font.bmp", true); SUB_BG2_CR = BG_TILE_BASE(char_base) | BG_MAP_BASE(screen_base) | ROTBG_SIZE_256x256; u16* sub_tile = (u16*)CHAR_BASE_BLOCK_SUB(char_base); u16* sub_map = (u16*)SCREEN_BASE_BLOCK_SUB(screen_base); consoleInit((u16*)fontData, sub_tile, 95, 32, sub_map, CONSOLE_USE_COLOR255, 8); for(i = 0; i < fontDataSize; ++i) { sub_tile[i] = fontData[i]; } // extended palettes are written with bank mapped to lcd vramSetBankH(VRAM_H_LCD); // each background has it's own set of 16 256 color palettes for(i = 0; i < fontPaletteSize; ++i) { VRAM_H_EXT_PALETTE[2][0][i]= fontPalette[i]; } // map bank to extended palette after writing data vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); printf("AAA BBB CCC DDD\n "); |
And here's how I'm copying data to BG3:
Code: |
memcpy(BG_GFX_SUB,tContainer->get16(),65536);
memcpy(BG_PALETTE_SUB,tContainer->getPal(),256); |
I think the problem here is BG_GFX_SUB really doesn't tell the code WHICH exrot background to put it on. Both code segments work, just not at the same time. I've seen this method of moving data to the screen used in a lot of examples, but none of them deal with using BOTH backgrounds in mode 5.
_________________
FireSlash.net