掌機 - Game Boy Color - C/C++ - Font



參考資訊:
https://bgb.bircd.org/
https://github.com/mrombout/gbdk_playground
http://gbdk.sourceforge.net/doc/html/book01.html

Font Functions

1
2
3
4
5
6
7
8
extern UINT8 font_ibm[];
extern UINT8 font_min[];
extern UINT8 font_spect[];
extern UINT8 font_italic[];
 
void font_init(void) NONBANKED;
font_t font_load(void *font) NONBANKED;
font_t font_set(font_t font_handle) NONBANKED;

main.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <stdio.h>
#include <gb/gb.h>
#include <gb/cgb.h>
#include <gb/font.h>
  
unsigned short palette[] = {RGB_WHITE, RGB_RED, RGB_GREEN, RGB_BLUE};
 
void main(void)
{
    font_init();
    font_set(font_load(font_spect));
    set_bkg_palette(0, 1, palette);
    printf("New font!");
}

完成