#148847 - jonezer4 - Fri Jan 11, 2008 4:16 am
Hey all, I have a problem getting console font to work on my subscreen, displaying over a graphic background. It used to be a 256x256 8-bit background, and my code worked fine, but I have had to change it to a 16-bit (I couldn't get Grit to make 8bit backgrounds).
So anyway, my question is, how do I go about getting a console default font to work over the new 16 bit background?
Here's my old code (the one that worked with 8 bit backgrounds):
So anyway, my question is, how do I go about getting a console default font to work over the new 16 bit background?
Here's my old code (the one that worked with 8 bit backgrounds):
Code: |
void initializeVRAM() { //Map VRAM vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_SPRITE_0x06400000, VRAM_C_SUB_BG_0x06200000, VRAM_D_SUB_SPRITE); //Use main Screen (bottom) for image videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE | DISPLAY_SPR_ACTIVE //Initiate sprites | DISPLAY_SPR_1D //1D sprites, tile mode | DISPLAY_SPR_1D_SIZE_256 //Setting each index to 256 bytes. This ); //will allow for indexes of multiples //of 16, and hence 1024/16=64 sprites. BG3_CR = BG_BMP8_256x256 | BG_BMP_BASE(0) | BG_PRIORITY(3); // Use the sub screen (top) for output videoSetModeSub(MODE_5_2D | DISPLAY_BG0_ACTIVE //text | DISPLAY_BG2_ACTIVE //image | DISPLAY_SPR_ACTIVE //sprites! | DISPLAY_SPR_1D | DISPLAY_SPR_1D_SIZE_256 ); //vramSetBankH(VRAM_H_SUB_BG); //vramSetBankI(VRAM_I_SUB_SPRITE); ///////////////set up our bitmap background/////////////////////// SUB_BG2_CR = BG_BMP8_256x256 | BG_BMP_RAM_SUB(1) | BG_PRIORITY(3); SUB_BG0_CR = BG_MAP_BASE(31) | BG_PRIORITY(1) | BG_COLOR_16 ;//use bg1 for the text //SUB_BG2_CR = BG_BMP8_256x256 | BG_BMP_BASE(1) | BG_PRIORITY(1); //these are rotation backgrounds so you must set the rotation attributes: //these are fixed point numbers with the low 8 bits the fractional part //this basicaly gives it a 1:1 translation in x and y so you get a nice flat bitmap BG3_XDX = 1 << 8; BG3_XDY = 0; BG3_YDX = 0; BG3_YDY = 1 << 8; BG3_CX = 0 << 8; BG3_CY = 0 << 8; SUB_BG2_XDX = 1 << 8; SUB_BG2_XDY = 0; SUB_BG2_YDX = 0; SUB_BG2_YDY = 1 << 8; SUB_BG2_CY = 32 << 8; //preventing console font from writing over data dmaCopy(mainBG_bin, BG_GFX, 256 * 192); //These offsets are for console font dmaCopy(mainBGPal_bin,BG_PALETTE, mainBGPal_bin_size); dmaCopy(mainBG_bin + 256*192, &BG_GFX_SUB[0x1000], 256 * 256); dmaCopy(mainBGPal_bin, &BG_PALETTE_SUB[0x1000], mainBGPal_bin_size); //consoleInit() is a lot more flexible but this gets you up and running quick consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); BG_PALETTE_SUB[255] = RGB15(31,31,5); //font color must be set here } |