From 5a4f75c418de58a3f3f50c8f6cb54a6bcf3def3c Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Tue, 9 Sep 2025 11:26:27 +1000 Subject: [PATCH] test standard ncurses graphing template --- lib/graph.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/graph.h | 6 ++++++ 2 files changed, 60 insertions(+) create mode 100644 lib/graph.c create mode 100644 lib/graph.h diff --git a/lib/graph.c b/lib/graph.c new file mode 100644 index 0000000..4924733 --- /dev/null +++ b/lib/graph.c @@ -0,0 +1,54 @@ +#include + +// void init_colors() { +// start_color(); +// init_pair(1, COLOR_GREEN, COLOR_BLACK); +// init_pair(2, COLOR_CYAN, COLOR_BLACK); +// init_pair(3, COLOR_MAGENTA, COLOR_BLACK); +// init_pair(4, COLOR_YELLOW, COLOR_BLACK); +// } + +// int main(void) { +// initscr(); +// printw("Goodbye World..."); +// refresh(); +// getch(); +// endwin(); + +// return 0; +// } + +int main(void) { + initscr(); + raw(); + // cbreak(); + // noecho(); + // echo(); + // curs_set(0); + keypad(stdscr, TRUE); // enable F1, F2, etc + noecho(); + // nodelay(stdscr, TRUE); + + // getmaxyx(stdscr, max_y, max_x); + // init_colors(); + printw("Type: "); + refresh(); + + int ch; + while (1) { + ch = getch(); + if (ch == KEY_F(1)) { + printw("[!] F1\n"); + break; + } + + attron(A_BOLD); + printw("%c", ch); + attroff(A_BOLD); + refresh(); + // napms(50); + } + + endwin(); + return 0; +} diff --git a/lib/graph.h b/lib/graph.h new file mode 100644 index 0000000..f72bbc6 --- /dev/null +++ b/lib/graph.h @@ -0,0 +1,6 @@ +#ifndef DORNE_GRAPH_H +#define DORNE_GRAPH_H + + + +#endif /* DORNE_GRAPH_H */