So far...
This commit is contained in:
parent
b013168679
commit
8c5e9aa105
|
|
@ -29,14 +29,3 @@ clean:
|
||||||
$(RM) $(TXTS)
|
$(RM) $(TXTS)
|
||||||
$(RM) $(BMPS)
|
$(RM) $(BMPS)
|
||||||
|
|
||||||
|
|
||||||
# -size 1130x27 \
|
|
||||||
# label:@text.txt \
|
|
||||||
|
|
||||||
# 1129 x 27 / 95 chars
|
|
||||||
#>>> 1129 + 1
|
|
||||||
#1130
|
|
||||||
#>>> 1130 // 95
|
|
||||||
#11
|
|
||||||
#>>>
|
|
||||||
# so 11 pixels per character?
|
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,26 @@ for i, _ in enumerate(txt):
|
||||||
with Image.open(f'{i:02}.bmp') as im:
|
with Image.open(f'{i:02}.bmp') as im:
|
||||||
assert im.size == (w, h), f'bad size {i:02}.bmp {w} x {h}!'
|
assert im.size == (w, h), f'bad size {i:02}.bmp {w} x {h}!'
|
||||||
|
|
||||||
print(f'const int font_width = {w};')
|
print(f'''\
|
||||||
print(f'const int font_height = {h};')
|
|
||||||
print(f'pixel_t font_data[{len(txt)}][{w * h}] = {{')
|
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):
|
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:
|
with Image.open(f'{i:02}.bmp') as im:
|
||||||
data = list(im.getdata())
|
data = list(im.getdata())
|
||||||
for blue, green, red, alpha in data:
|
for n, (blue, green, red, alpha) in enumerate(data):
|
||||||
print(f'\t\t{{0x{blue:02x}, 0x{green:02x}, 0x{red:02x}, 0x{alpha:02x}}},')
|
if blue or green or red or alpha:
|
||||||
print(f'\t}},')
|
print(f'\tfont_data[{i}][{n}] = 0x{alpha:02x}_{red:02x}_{green:02x}_{blue:02x};')
|
||||||
print(f'}};')
|
print(f'}};')
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -43,7 +43,7 @@ void
|
||||||
mousemove(u64 window_id, u64 new_x, u64 new_y)
|
mousemove(u64 window_id, u64 new_x, u64 new_y)
|
||||||
{
|
{
|
||||||
u32* pix_ptr = frame_buffer + FRAME_WIDTH * new_y + new_x;
|
u32* pix_ptr = frame_buffer + FRAME_WIDTH * new_y + new_x;
|
||||||
*pix_ptr = RED;
|
*pix_ptr = GREEN;
|
||||||
window_draw_frame(window_id, frame_buffer);
|
window_draw_frame(window_id, frame_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue