From 121aaa819958473e12197ff48933f7ca8cc4e7bc Mon Sep 17 00:00:00 2001 From: sumuel Date: Thu, 6 Aug 2026 13:54:49 +0100 Subject: init --- main.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..b79f16d --- /dev/null +++ b/main.c @@ -0,0 +1,46 @@ +#include +#include +#include "board.h" + +int main(void) { + initscr(); /* Start curses mode */ + if(has_colors() == FALSE) + { endwin(); + printf("Your terminal does not support colour\n"); + return 1; + } + start_color(); /* Start color */ + noecho(); + curs_set(0); + /* End of ncurses init nonsense */ + + int ch; + bool reveal = false; + generate_first_line(puzzle); + generate_puzzle(puzzle); + + while (1) { + print_puzzle(puzzle, reveal); + + ch = getch(); + switch (ch) { + case 'q': + endwin(); + return 1; + break; + case 'g': + reveal = false; + generate_first_line(puzzle); + generate_puzzle(puzzle); + break; + case 'r': + if ( reveal == true ) reveal = false; + else reveal = true; + break; + } + clear(); + }; + + endwin(); /* End curses mode */ + return 0; +} -- cgit v1.2.3