Yeah you are definetely right and i know that. Sadly i have no idea what is going on there and don’t understand the half of it…¯\(ツ)/¯
I’m pretty sure that someone also can remove the masking stuff/sprite and do that by code.
As said i appreciate any help with this. The best in form of a pull request.
It would be nice if this were made into a library containing a class that inherits the Arduino Print class, like the Arduboy2 library does. This way, like Arduboy2, you would be able to use all the Arduino Print features
tinyfont.println(F("hello from PROGMEM"));
int val = 0x0c1d;
If you wanted to make it more portable (possibly at the expense of slightly larger code size), don’t include Arduboy2.h or reference Arduboy2Base directly. Pass a pointer to the screen buffer to the Tinyfont class:
// Use Arduboy2Base instead of Arduboy. We don't need Arduboy2's fonts
Or, to access the screen buffer directly, make your class a template, the way @igvina’s ArdBitmap class does.
If you like, I can help with getting your library included in the Arduino Library Manager, if you get to that point.
Use a template class to provide direct access to the screen buffer
The above method accesses the screen buffer indirectly via a pointer. Since the buffer location is static, the code would be a bit smaller and faster if we could access it directly. This is difficult with Arduino since libraries are compiled independently from the sketch, so can’t be influenced by #defines in the sketch. However, we can use the “trick” of making the library’s class a template. A template isn’t compiled until the point that it’s #included in the sketch. This allows us to pass #define values to it.
As I said, the ArdBitmap library is an example of using a template to allow accessing the screen buffer directly.
If he’s just going to copy the drawPixel code verbatim though he really should just use the existing drawPixel as then the compiled won’t have to link two different drawPixels (unless it’s smart enough to figure out they are both the same?).
True. I didn’t look at the code closely enough to notice that drawPixel() was unchanged. In this case, both the screen buffer and a reference to drawPixel() could be passed to the constructor or template.
Oh I was thinking the default arduboy.print("whatever_you_want_to_print");
tiny font thing…
But yeah, that fonf was pretty cool. Tiny, yet totally understandable.
Pulling that over to the Windows side…
That font looks great and I am testing it inside the new game I am making. Is there a function to change the size of the text? Like “arduboy.setTextSize(2)”? I know it won’t be tiny anymore if I do that but I like the square shape of these letters. Thanks!