begin shfx (shell f(x)), graphing cli
This commit is contained in:
parent
492ec8832c
commit
bd87f194f2
1 changed files with 44 additions and 0 deletions
44
shfx/main.c
Normal file
44
shfx/main.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
#define BASE_DELAY 1000000
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// Curses init
|
||||
WINDOW *screen = initscr();
|
||||
start_color();
|
||||
nodelay(screen, 1);
|
||||
cbreak();
|
||||
noecho();
|
||||
curs_set(0);
|
||||
keypad(screen, TRUE);
|
||||
|
||||
// Color pairs
|
||||
init_pair(1, COLOR_BLACK, COLOR_CYAN);
|
||||
|
||||
// Set background
|
||||
wbkgd(screen, COLOR_PAIR(1));
|
||||
|
||||
attron(COLOR_PAIR(1));
|
||||
attron(A_BOLD);
|
||||
int counter = 0;
|
||||
while (1) {
|
||||
mvprintw(0, 0, "COUNTER %d", counter++);
|
||||
refresh();
|
||||
|
||||
switch (getch()) {
|
||||
case 'q':
|
||||
goto end;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
usleep(BASE_DELAY);
|
||||
}
|
||||
|
||||
end:
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue