Hacker News new | past | comments | ask | show | jobs | submit login

Does anyone know of any minimal TUI libraries? Something in the spirit of a VGA text buffer, that allows the user to manage their own cell buffer as a block of memory, and allows them to blit that to the terminal -- and ideally have that work across a variety of platforms and terminal emulators?



https://github.com/nsf/termbox is a very well known one, and has inspired several clones in other languages as well.


I second termbox. It's a well crafted library, and easy to understand by just reading the h file. I wrote the Ada binding for it just a few weeks ago.



You can use ncplane_blit_rgba() and ncplane_blit_bgrx() from Notcurses to freely blit RGBA data directly to the terminal. In addition, you'll benefit from the various advanced blitters built into Notcurses. Simply moving from pixels to cells in the naive method doesn't look good due to the different aspect ratios. Half blocks are a much better solution, and my quadrant blitter is superior to even those IMHO (all are available via the NCBLIT_* macros).


As an example, here's Notcurses as a backend for NEStopia, allowing you to play NES in the terminal: https://www.youtube.com/watch?v=PHOHxqGkTUA&t=77s (this video was very early and raw, apologies for the production quality or lack thereof).

I've experimentally rigged Notcurses as a backend for both Mesa and Cairo. Works fine, so long as you've got sufficient cells to back your canvas.


A little more advanced is CPPurses with a widget framework for creating TUIs,:

https://github.com/a-n-t-h-o-n-y/CPPurses


Thanks, I've added CPPurses to the Notcurses OTHERS.md file: https://github.com/dankamongmen/notcurses/blob/master/OTHERS...

Taking a quick look, I don't want to besmirch anyone else's efforts, and both of these projects look great. libtickit appears to be missing any kind of multimedia/pixel-based approach along the lines of Notcurses's ncvisual -- I'm not sure about CPPurses, but that one being written in C++ would seem to exclude pure C programs (obviously not if it's using POD structures etc).

Both look like good efforts, and there's plenty of room for more than one project in this space. I wish them both luck!


I was going to mention gui.cs but I don't think it does TRS-80 style memory access-to-draw like you were asking for.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: