The Library

Published on 2017-08-06 in PewPew FeatherWing.

Today I finished the CircuitPython library for the PewPew Lite. It still has some room for improvement, especially in terms of memory use, but it already has the shape that I’m basically happy about.

I had to completely rewrite it from my initial code, since I want it to be a little bit higher level than it was initially. Apart from_init_, which is used for setup at the beginning, there are only four functions:

Then there is a class for representing the images in memory, which have five methods:

That’s it. The whole library has about 200 lines of code (including the font data), but lets you conveniently do things such as scrolling, displaying text, displaying animations, showing maps, moving around sprites, etc.

For testing, I’m writing all this code on a Feather M0 Basic, which is the smallest and slowest device that runs CircuitPython — to make sure that the speed is acceptable for it, and that everything fits in the memory.

Here is a simple scrolling menu written using all this, which I plan to use for selecting the games at the beginning: