r/cprogramming • u/Skollwarynz • Oct 15 '26
How to create a minimal GUI
Hello everyone, I'm currently experimenting with an old router and I wanted to create some custom C programs to experiment with it. The first one is to create a simple Htop/fetch to examine the system specs in real time. I wanted to create a sort of GUI like Btop or Htop, but the problem is that I don't have that much RAM (we are talking something like 34 MB of free space) so I want to implement a minimal one. I wanted to ask for some suggestions about it. Thank you.
12
Upvotes
11
u/Fun_Wish1844 Oct 15 '26
Btop and htop are TUI’s.
5
u/dettus_Xx_ Oct 15 '26
Is using the ncurses library an option?
Other than that: printf("\x1b[1;34mhello\x1b[0m"); ANSI codes.
4
u/InfiniteCobalt Oct 16 '26
LVGL https://lvgl.io/
2
u/Aghoradas Oct 16 '26
Wxwidgets is pretty easy to use
3
u/Sorry_Difficulty_250 Oct 15 '26
A few MB of RAM is plenty for a simple GUI. Windows 3.0 would run in 640 KB. The question would come down to rendering. Does this thing have a video card that you're connecting to or is this all over a network connection?
2
u/non-existing-person Oct 15 '26
If you don't have ram, but you have flash, and it's a router, then I'd do gui in... html+js.
Yep. Simple http server that serves static files, and some very small C program to act as an API endpoint that would send out data on request.
1
u/Syntax-Tactics Oct 16 '26
Look into SDL3.