Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Last active August 29, 2015 14:11
Show Gist options
  • Save NigoroJr/2acb1bf5a8f938062774 to your computer and use it in GitHub Desktop.
Save NigoroJr/2acb1bf5a8f938062774 to your computer and use it in GitHub Desktop.
Sample program using ncurses library
#include <ncurses.h>
#include <unistd.h>
#include <string>
// Compile program with -lncursesw option
int main(int argc, char const* argv[]) {
WINDOW* win;
std::string mes = "♔ ♚ ♕ ♛ ♖ ♜ ♗ ♝ ♘ ♞ ♙ ♟";
setlocale(LC_CTYPE, "");
win = initscr();
if (win == NULL) {
return 1;
}
// Don't echo input
noecho();
//printw("Hello World!\n");
for (int i = 0; i < 5; i++) {
clear();
mvaddstr(2 + i, 30, mes.c_str());
refresh();
// Wait a litle bit
sleep(1);
}
// Wait for input
getch();
/* Cleanup */
delwin(win);
endwin();
refresh();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment