gui_engine, statically-linked GUI apps for the initrd

Moderator: BarryK

Post Reply
User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

The title says it all. See more details in my blog post:

https://bkhome.org/news/202301/guiengin ... nitrd.html

I posted a thank you to the author of gui_engine:

https://github.com/AlxHnr/gui_engine/issues/3

It is a dead project, but the C code is so small, a quick look at it, reckon anyone with a smattering of C coding ability could take-on improving it.

Adding sdl-ttf would be good, though that requires freetype -- I wonder how much that will bump the size, statically-linked?

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

Got around the road block, SDL_ttf now works:

https://bkhome.org/news/202301/back-in- ... dlttf.html

On to Lesson 08!

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

Lesson 08; introduces key presses:

https://bkhome.org/news/202301/learning ... on-08.html

So was able to add ESC key to exit from the gui_engine code.

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

The statically-linked example.c in gui_engine, with SDL_ttf, freetype and libpng linked in, the standalone binary is 560KB. Quite good I reckon.

Posted about it here:

https://bkhome.org/news/202301/statical ... 560kb.html

Now a ready-to-go basis for creating GUI apps in the initrd.

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

Getting started learning how gui_engine works, I created a map showing the function hierarchy:

gui-engine-funcs.png
gui-engine-funcs.png (78.91 KiB) Viewed 368 times

gui_engine is just one file, gui_engine.c, and the above map is of the functions in it. There is also gui_engine.h

The green boxes are the functions called from the 'example.c' file, to give an indication what ones are most relevant when creating an app.

Note, the map was created with Dia, exported to SVG then opened in Inkscape and exported to PNG, then opened in mtPaint and the size reduced by reducing number of colours and changing to indexed mode. Resulting 896x680 file is only 36KB.

Interesting, after uploading here, it is 79KB. I downloaded it and it is 79KB. The original is 36KB. Why is that?

Same image uploaded to my blog is 36KB:

https://bkhome.org/news/202301/images/g ... -funcs.png

User avatar
BarryK
Posts: 2694
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: gui_engine, statically-linked GUI apps for the initrd

Post by BarryK »

More progress. Have learnt the basics of rendering TTF text, and made a start with gui_engine.

For now, have just done the window titlebar:

https://bkhome.org/news/202301/ttf-text ... ngine.html

ttf-titlebar.png
ttf-titlebar.png (9.93 KiB) Viewed 296 times

...an improvement over bitmap text!

Post Reply

Return to “EasyOS”