brilliantlabsAR / monocle-micropython

Micropython ported to the Monocle
ISC License
221 stars 27 forks source link

Sprites support #254

Closed josuah closed 1 year ago

josuah commented 1 year ago

This would merge all the latest work done on main onto dev as part of the process.

See #273

josuah commented 1 year ago

Waiting https://github.com/brilliantlabsAR/monocle-fpga/issues/19

josuah commented 1 year ago

This might still need some work, but initial results are there.

The font drawing appears to be correct: the glyphs are aligned horizontally, with a reasonable space between them, with the correct font, but the display is not behaving as I'd expect it to be.

Maybe some wrong parameter given to the FPGA?

mpv-shot

The way to test is to first generate a font.bin:

$ cd monocle-micropython/tools
$ python3 fontgen.py ShareTechMonoBitmap-Regular-64.bdf selection.txt ShareTechMonoBitmap-Regular-64.bin

ShareTechMonoBitmap-Regular-64.zip selection.txt

Then upload SharedTechMonoBitmap-Regular-64.bin as font.bin, and run this on the Monocle:

from font import *
from display import *
from text import *

font = Font("font.bin")
text = Text("abcd", font, 0xffffffff)
show_sprites(text.to_sprites())