site  contact  subhomenews

Statically-linked gui_engine example with TTF support is 560KB

January 18, 2023 — BarryK

I originally posted about gui_engine here, it runs as a statically-linked binary in the initrd:

https://bkhome.org/news/202301/guiengine-runs-in-initrd.html

Then posted about success with SDL_ttf:

https://bkhome.org/news/202301/back-in-business-with-sdlttf.html

So, compiled SDL-ttf and dependencies freetype and libpng, as static libraries, in OE, then added some SDL_ttf functions into 'example.c' in gui_engine. The compiled example.c, linking in those extra libraries. The statically-linked binary was 304KB, it is now 560KB.

I reckon that is very good. A completely standalone application, with SDL, SDL_gfx, SDL_ttf, freetype, libz and libpng all linked-in, very reasonable size.

The 'example.c' is now ready to be expanded, render TrueType fonts instead of console fonts, add one or two extra widgets -- I would like a list widget, to show the list of languages, as did earlier using 'dialog' in the initrd.

It is all very well wanting to do the above, but first have to study the code of gui_engine, figure how it all hangs together.  

Tags: easy