CustomFont.pp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. program custom_font;
  2. {$L build/font.o}
  3. {$mode objfpc}
  4. uses
  5. ctypes, nds9;
  6. const
  7. fontPalLen = 32;
  8. fontTilesLen = 3072;
  9. tile_base = 0;
  10. map_base = 20;
  11. var
  12. fontTiles: array [0..767] of cushort; cvar; external;
  13. fontPal: array [0..255] of cushort; cvar; external;
  14. console: pPrintConsole;
  15. font: ConsoleFont;
  16. keys: integer;
  17. begin
  18. videoSetModeSub(MODE_0_2D);
  19. vramSetBankC(VRAM_C_SUB_BG);
  20. console := consoleInit(nil, 0, BgType_Text4bpp, BgSize_T_256x256, map_base, tile_base, false, false);
  21. font.gfx := pcuint16(fontTiles);
  22. font.pal := pcuint16(fontPal);
  23. font.numChars := 95;
  24. font.numColors := fontPalLen div 2;
  25. font.bpp := 4;
  26. font.asciiOffset := 32;
  27. font.convertSingleColor := false;
  28. consoleSetFont(console, @font);
  29. printf('Custom Font Demo'#10);
  30. printf(' by Poffy'#10);
  31. printf('modified by WinterMute'#10);
  32. printf('for libnds examples'#10);
  33. while true do
  34. begin
  35. swiWaitForVBlank();
  36. scanKeys();
  37. keys := keysDown();
  38. if (keys and KEY_START) <> 0 then break;
  39. end;
  40. end.