I've been experimenting with my C++ app that is a train and node simulator. I can get a train to move between nodes, opening me up to being able to find a best path and handle obsticles. This is still to do.

However, it's getting a little more complicated watch it step through it's motions by simply watching console output. Games need interfaces, even if it's something console based. Enter NCurses. This was easier to implement than I thought.

Most of my instruction and samples came from this HOWTO.

First, was simply including:

#include <ncurses.h>

Setting up a simple window was putting this towards the top of the program:

// Setup screen

initscr();  // Start curses mode
cbreak();   // Disable line buffering, send everything from screen

Then, writing to the screen, was simply writing to a x,y location on the screen:

mvprintw(0,0, "Train   - Location - Destination - Distance - Stops");

After several lines to write what you want, then simply "refresh" the screen to blit the window into the active window.


At the end of the program:

endwin();  // Close curses windows

That's it. Yes, there are interfaces for menus and sub windows, but this can get me pretty far.