#include <nds.h>
#include <nds/arm9/console.h>
#include <stdio.h>
//Include the font data here Doesn't have to be .h! Can be .c and what not.
#include "font.h"
int main(void) {
//---------------------------------------------------------------------------------
irqInit();
irqEnable(IRQ_VBLANK);
unsigned int i;
const int char_base = 0;
const int screen_base = 20;
videoSetMode(0);
videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE | DISPLAY_BG_EXT_PALETTE);
vramSetBankC(VRAM_C_SUB_BG);
SUB_BG3_CR = ROTBG_SIZE_256x256 | BG_TILE_BASE(char_base) | BG_MAP_BASE(screen_base);
// SUB_BG3_CR = BG_256_COLOR | BG_TILE_BASE(char_base) | BG_MAP_BASE(screen_base);
BG3_XDX = 1 << 8;
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = 1 << 8;
BG3_CX = 0;
BG3_CY = 0;
u16* sub_tile = (u16*)CHAR_BASE_BLOCK_SUB(char_base);
u16* sub_map = (u16*)SCREEN_BASE_BLOCK_SUB(screen_base);
//95 and 32 show how many characters there are and 32 shows which ASCII character to start, respectively
//95 is the smaller set of ACSII characters. It usually will start with 32
consoleInit((u16*)fontData, sub_tile, 95, 32, sub_map, CONSOLE_USE_COLOR255, 8);
//Load the Font Data and Palette stuff here
for(i = 0; i < fontDataSize; ++i) {
sub_tile[i] = fontData[i];
}
vramSetBankH(VRAM_H_LCD);
for(i = 0; i < fontPaletteSize; ++i) {
BG_PALETTE_SUB[i] = fontPalette[i];
}
dmaCopy(BG_PALETTE_SUB,VRAM_H+0x6000,fontPaletteSize*2);
vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE);
iprintf("Custom Font Demo\n");
iprintf(" by Poffy\n");
iprintf("modified by WinterMute\n");
iprintf("for libnds examples\n");
while(1) {
swiWaitForVBlank();
}
return 0;
}