begin shfx (shell f(x)), graphing cli

This commit is contained in:
Emile Clark-Boman 2025-09-09 15:43:20 +10:00
parent 492ec8832c
commit bd87f194f2

44
shfx/main.c Normal file
View 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;
}