Have you ever found yourself needing to write some text in your game/app/whatever?
By “write some text”, I don’t mean fiddling with TTF fonts, handling rendering variants or managing SDL_Surfaces, creating textures from them, freeing them, etc.
I really mean writing text, just like that.
If you’re anything like me, you have been more than often in such an unpleasant situation. The solution? SDL_pcf!
This new library will let you do exactly this: Writing pixel-perfect text, with thousands of existing bitmap fonts. It leverages proven code from X11 and makes it work with SDL, in just 3 easy steps:
- Open a font
- Write text at a given location, directly to a SDL_Surface or a SDL_Renderer.
- Close the font when you don’t need it anymore
No more temporary surfaces, no conversion, no nothing. Just fire and forget.
What about hardware acceleration you said? SDL_pcf does that too. Just tell it what you’ll need (it can be the whole font) and SDL_pcf will create a pre-rendered charset that can go live on the GPU memory for lightning-fast blits.
Try me now at https://github.com/sam-itt/sdl-pcf for the 0.0.1 release, including code samples and full documentation at https://sdl-pcf.readthedocs.io/en/latest/.