writting a fun cli apps with ncurses

Do you feel like writing a nice CLI Application? Where you can manipulate your text in any position and any combination of colors. There are plenty of CLI apps are nicely build with positioning and colors, such as vim, kismet, irssi, screen etc. You can do it in c/c++ with the help of ncurses library.

Do it with ncurses is not difficult, check out the ncurses programming HowTo. This tutorial was well written, it covers from beginners (hello world example) to advance level (uses widget libraries). It includes also some fun game examples just to illustrate the capabilities of ncurses. I have wrote one after taking two days reading the ebook.

matrix 0.2

Matrix 0.2
A simple matrix animation using ncurses library, license under GNU GPL.

Usage: matrix [option]...
matrix --version
matrix --help

-c [1-7] Color value from 1 to 7, default is 2
-t [string] Text heading for each flow string
-s [1-9] The flow speed, 1 fastest, 9 slowest
-l [1-50] Default have 25 flow strings, you can add more
-b Use black as background
-v Print Version
-h Print Usage

Internal Usage:
q | enter Quit the program
[1-7] Changing color

matrix 0.2 bin
matrix 0.2 source code

To compile the source code, you must have ncurses library installed.

g++ -o matrix{,.cc} -lncurses

For more g++ examples, check out linux.byexamples.com.
To print string in colors without ncurses, here.
To print string at any position without ncurses, here.

6 thoughts on “writting a fun cli apps with ncurses

  1. Pingback: Non-blocking user input in loop without ncurses.

  2. Pingback: How to list shared library dependencies used by an application

Leave a Reply

Your email address will not be published. Required fields are marked *