add some ncurses snippets

This commit is contained in:
2020-12-21 16:58:32 +03:00
parent 1af9716058
commit dbe431a121
14 changed files with 899 additions and 0 deletions

28
Ncurses/rolling.c Normal file
View File

@@ -0,0 +1,28 @@
#include <curses.h>
#include <stdlib.h>
static int maxx, maxy;
void initscreen(){
initscr();
getmaxyx(stdscr, maxy, maxx); // getyx - get current coords
cbreak();
keypad(stdscr, TRUE); // We get F1, F2 etc..
noecho();
nodelay(stdscr, TRUE); // getch() returns ERR if no keys pressed
start_color();
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_MAGENTA, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
clear();
}
int main(){
initscreen();
return 0;
}