So far...

This commit is contained in:
Simon Forman 2023-02-26 09:37:20 -08:00
parent b013168679
commit 8c5e9aa105
4 changed files with 24 additions and 33205 deletions

View File

@ -29,14 +29,3 @@ clean:
$(RM) $(TXTS)
$(RM) $(BMPS)
# -size 1130x27 \
# label:@text.txt \
# 1129 x 27 / 95 chars
#>>> 1129 + 1
#1130
#>>> 1130 // 95
#11
#>>>
# so 11 pixels per character?

View File

@ -16,16 +16,26 @@ for i, _ in enumerate(txt):
with Image.open(f'{i:02}.bmp') as im:
assert im.size == (w, h), f'bad size {i:02}.bmp {w} x {h}!'
print(f'const int font_width = {w};')
print(f'const int font_height = {h};')
print(f'pixel_t font_data[{len(txt)}][{w * h}] = {{')
print(f'''\
int font_width = {w};
int font_height = {h};
u32 font_data[{len(txt)}][{w * h}];
void
init_font_data(void)
{{
\tmemset(font_data, 0, {4 * len(txt) * w * h});
''')
for i, ch in enumerate(txt):
print(f'\t{{ // {repr(ch)}')
print(f'\t// {repr(ch)}')
with Image.open(f'{i:02}.bmp') as im:
data = list(im.getdata())
for blue, green, red, alpha in data:
print(f'\t\t{{0x{blue:02x}, 0x{green:02x}, 0x{red:02x}, 0x{alpha:02x}}},')
print(f'\t}},')
for n, (blue, green, red, alpha) in enumerate(data):
if blue or green or red or alpha:
print(f'\tfont_data[{i}][{n}] = 0x{alpha:02x}_{red:02x}_{green:02x}_{blue:02x};')
print(f'}};')
##

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ void
mousemove(u64 window_id, u64 new_x, u64 new_y)
{
u32* pix_ptr = frame_buffer + FRAME_WIDTH * new_y + new_x;
*pix_ptr = RED;
*pix_ptr = GREEN;
window_draw_frame(window_id, frame_buffer);
}