Last active
August 29, 2015 14:11
-
-
Save NigoroJr/2acb1bf5a8f938062774 to your computer and use it in GitHub Desktop.
Sample program using ncurses library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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