X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_13%2Fexo2%2Fsrc%2Fmain.c;fp=TP_13%2Fexo2%2Fsrc%2Fmain.c;h=fcd3bcc04279d7d61d6f5b838e00794d10f6f7ad;hb=7515f89753dd7d16c4f2a9b11003f67d8148eb09;hp=0000000000000000000000000000000000000000;hpb=210f7f057cbb8acbc783ffd1ac7333d6cf613ce4;p=TD_C.git diff --git a/TP_13/exo2/src/main.c b/TP_13/exo2/src/main.c new file mode 100644 index 0000000..fcd3bcc --- /dev/null +++ b/TP_13/exo2/src/main.c @@ -0,0 +1,38 @@ +#include +#include +#include + +#include "display.h" + +int main() { + int row, col; + + initscr(); + getmaxyx(stdscr,row,col); + noecho(); + curs_set(0); + + /* center base coordinates for the board */ + const int base_y = row/2 - 4; + const int base_x = col/2 - 7; + + print_board(base_y, base_x); + + print_x(base_y, base_x + 1); + print_o(base_y, base_x + 6); + print_o(base_y, base_x + 11); + print_o(base_y + 3, base_x + 1); + print_o(base_y + 6, base_x + 1); + print_o(base_y + 3, base_x + 6); + print_x(base_y + 3, base_x + 11); + print_x(base_y + 6, base_x + 6); + print_x(base_y + 6, base_x + 11); + + refresh(); + + while (getch() != 'q'); + + endwin(); + + exit(EXIT_SUCCESS); +}