RuTui 0.4 - better TUI for Ruby
In July 2012 i created RuTui out of frustration on missing TUI (Text User Interface) librarys for Ruby. Indeed there is curses but it is kind of limited when it comes to colors and other personalisations. So something had to be done. My focus on the project was flexibility and for sure colors <3, after a major update this afternoon i decided it is time to promote this project a little.
What is RuTui?
RuTui is a Ruby gem which makes it incredibly easy to create terminal based user interfaces (TUIs). It is developed with ansi escaping standards and support for 256 colors in mind, this means there is a strict limitation on which terminals this works. It works on the most linux desktop terminals, it is not proper colored on tty and for sure wont work on cmd.exe. But bringing and testing this lib to more plattforms including Windows and MacOSX is part of my future plans for this gem. push requests for sure are welcome too.
Edit// it now works in cmd.exe (even colors through ansicon)
But it can do a lot more, there are sortable Tables, varius Shapes, Textfields, Themes, a straight forward ScreenManager, even animated Sprites. Basicly you have everything you need to create an user interface for any terminal app. If this still is not enough for you, read on.
Flexibility planned in
If you read trough the source you will see everything is kept very simple and basic. Its a nifty OO structure which is easily extensible. Each object is based on the BaseObject which provides the default structure that elements need to be able to be drawn from the screen. The object itself is an array with following structure:
@obj = [ [Pixel.random, Pixel.random, Pixel.random] [Pixel.random, Pixel.random, Pixel.random] ]
A pixel is a simple object that consists of foreground & background -color and a single char. So all your own objects would have to provide is a array with row-arrays filled with pixels and for sure their position as X & Y coordinates, the rest gets done by the screen object itself.
Check it out
Keywords: tui, rutui, ruby, user interface, ui, project