From c1ac9aa30fa1c33ac09963bdb2f6a42ffadaa6c8 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Fri, 7 May 2021 10:18:48 +0200 Subject: Add a small 3x5 font --- src/main.c | 14 +++++++++----- src/small-font.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 src/small-font.c diff --git a/src/main.c b/src/main.c index 33e7ebf..3065842 100644 --- a/src/main.c +++ b/src/main.c @@ -6,22 +6,26 @@ #include "sprites.h" #include "text.h" #include "sequencer.c" -#include "bd-font.c" +#include "small-font.c" // // Main functions. // -// TODO: Cleanup OBJ/OAM memory copying and access. -// - int main(void) { // Configure the display in mode 0 to show OBJs, where tile memory is // sequential. DISP_CTRL = DISP_ENABLE_SPRITES | DISP_MODE_3 | DISP_BG_2; // Initialize text engine. - txt_init_bitmap(TXT_MODE_MODE3, (Font){.data = bd_font, .char_width = 6}); + txt_init_bitmap( + TXT_MODE_MODE3, + (Font){ + .data = small_font, + .char_width = 4, + .char_height = 8, + .char_map = small_font_map, + }); // Register interrupts. irq_init(); diff --git a/src/small-font.c b/src/small-font.c new file mode 100644 index 0000000..2f232dd --- /dev/null +++ b/src/small-font.c @@ -0,0 +1,45 @@ +u32 small_font[] = { + 0x00000000, 0x00000000, 0x00020202, 0x00020000, + 0x000a0a00, 0x00000000, 0x000a1f0a, 0x1f0a0000, + 0x02070107, 0x04070200, 0x00010402, 0x01040000, + 0x0007050f, 0x050d0000, 0x00020200, 0x00000000, + 0x00020101, 0x01020000, 0x00020404, 0x04020000, + 0x00050207, 0x02050000, 0x00000207, 0x02000000, + 0x00000000, 0x00020100, 0x00000007, 0x00000000, + 0x00000000, 0x00020000, 0x00040602, 0x03010000, + 0x00070505, 0x05070000, 0x00020302, 0x02070000, + 0x00070407, 0x01070000, 0x00070406, 0x04070000, + 0x00040605, 0x07040000, 0x00070107, 0x04070000, + 0x00070107, 0x05070000, 0x00070402, 0x01010000, + 0x00070507, 0x05070000, 0x00070507, 0x04040000, + 0x00000200, 0x00020000, 0x00000200, 0x00020100, + 0x00040201, 0x02040000, 0x00000700, 0x07000000, + 0x00010204, 0x02010000, 0x00070402, 0x00020000, + 0x00070505, 0x01070000, 0x00070505, 0x07050000, + 0x00070503, 0x05070000, 0x00070101, 0x01070000, + 0x00030505, 0x05030000, 0x00070103, 0x01070000, + 0x00070103, 0x01010000, 0x00070105, 0x05070000, + 0x00050507, 0x05050000, 0x00070202, 0x02070000, + 0x00040404, 0x05070000, 0x00050503, 0x05050000, + 0x00010101, 0x01070000, 0x00050705, 0x05050000, + 0x00030505, 0x05050000, 0x00030505, 0x05070000, + 0x00070507, 0x01010000, 0x00070505, 0x07040000, + 0x00070503, 0x05050000, 0x00060107, 0x04030000, + 0x00070202, 0x02020000, 0x00050505, 0x05070000, + 0x00050505, 0x05060000, 0x00050505, 0x07050000, + 0x00050502, 0x05050000, 0x00050507, 0x02020000, + 0x00070402, 0x01070000, 0x00070101, 0x01070000, + 0x00010302, 0x06040000, 0x00070404, 0x04070000, + 0x00020500, 0x00000000, 0x00000000, 0x00070000, +}; + +u8 small_font_map[256] = { + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , + 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 0 , 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 0 , 0 , 0 , 0 , 0 , +}; -- cgit v1.2.1