Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console display in C++ for cross platform

Using C++ for a cross platform console app, is there any way to implement a display which is static and dynamically changing, rather than an output which prints under the previous output? I.e. For a simple board game, rather than reprinting the board each turn, update a single output.

Edit: AFAIK, unicode is not entirely necessary, I am using only characters which appear on a standard EN-GB keyboard.

I'll look into NCURSES, although I was wondering if there something within the C++ standard which could help me achieve this. Call me ignorant if you like, but I'm just wondering.

like image 990
Joe Avatar asked Feb 19 '23 08:02

Joe


1 Answers

I think NCURSES is what you're looking for. Terminal wrapper for ConsoleUI, which is cross-platform. It allows you to write to a virtual screen buffer, and control when and how the refresh is being done. It does internal book-keeping of that buffer and will only refresh the characters which changed. Curses was designed in days where connection speed mattered so terminal refresh operations were being done in a smart way.

There's an ncurses tag at SO, so you'll find a lot of information here about the gritty details.

like image 177
count0 Avatar answered Feb 23 '23 09:02

count0