From 5e9251bd48acafff575ed1c740e4dc05ec175508 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 11 Mar 2015 14:35:54 +0100 Subject: Add simple drawing code & font loading. --- res/fonts/Makefile | 5 ++++- res/fonts/default.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'res') diff --git a/res/fonts/Makefile b/res/fonts/Makefile index e1daf03..c4de63d 100644 --- a/res/fonts/Makefile +++ b/res/fonts/Makefile @@ -1,5 +1,8 @@ +CC=gcc +CFLAGS=-I../../src/lib/include -std=c11 + %.bf: %.c - gcc -o $<.bin $< + $(CC) $(CFLAGS) -o $<.bin $< ./$<.bin > $@ rm $<.bin diff --git a/res/fonts/default.c b/res/fonts/default.c index 374c191..43fddce 100644 --- a/res/fonts/default.c +++ b/res/fonts/default.c @@ -1,6 +1,8 @@ #include #include +#include + char font_data[256][16] = { /* 0x00 */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x01 */ {0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00}, @@ -260,6 +262,13 @@ char font_data[256][16] = { /* 0xff */ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, }; +ascii_bitmap_font_header h = { + .magic = ASCII_BITMAP_FONT_MAGIC, + .cw = 8, + .ch = 16, + .nchars = 256, +}; + int main() { FILE *f = fopen("default.bf", "wb"); if (f == 0) { @@ -267,6 +276,7 @@ int main() { exit(1); } + fwrite(&h, 1, sizeof(h), f); fwrite(font_data, 256, 16, f); return 0; -- cgit v1.2.3