fonts.c (1182B)
1/* 2 fonts.c 3 Simple example of how to use multiple fonts on the GB 4 Michael Hope, 1999. 5*/ 6 7#include <stdio.h> 8 9#include <gbdk/platform.h> 10#include <gbdk/font.h> 11 12#include <gbdk/console.h> 13 14#define WHITE 3 15#define DKGREY 1 16 17void main(void) 18{ 19 font_t ibm_font, italic_font, min_font; 20 int i; 21 22 /* First, init the font system */ 23 font_init(); 24 25 /* Load all the fonts that we can */ 26 ibm_font = font_load(font_ibm); /* 96 tiles */ 27 italic_font = font_load(font_italic); /* 93 tiles */ 28 29 /* Load this one with dk grey background and white foreground */ 30 font_color(WHITE, DKGREY); 31 32 min_font = font_load(font_min); 33 34 /* Turn scrolling off (why not?) */ 35 mode(get_mode() | M_NO_SCROLL); 36 37 /* Print some text! */ 38 39 /* IBM font */ 40 font_set(ibm_font); 41 printf("Font demo.\n\n"); 42 43 printf("IBM Font #!?123\n"); 44 45 /* In italic */ 46 font_set(italic_font); 47 for (i=1; i!=5; i++) { 48 printf("In italics, line %u\n", i); 49 } 50 51 /* With a minimal, colour changed font */ 52 font_set(min_font); 53 printf("Minimal 36 tile font\n"); 54 55 /* Done */ 56 font_set(ibm_font); 57 printf("\nDone!"); 58} 59 60 61