From bd87f194f20872fcf1f584bac334065bf87b11ac Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Tue, 9 Sep 2025 15:43:20 +1000 Subject: [PATCH] begin shfx (shell f(x)), graphing cli --- shfx/main.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 shfx/main.c diff --git a/shfx/main.c b/shfx/main.c new file mode 100644 index 0000000..a70bd04 --- /dev/null +++ b/shfx/main.c @@ -0,0 +1,44 @@ +#include +#include + +#include + +#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; +}