Commit | Line | Data |
---|---|---|
7515f897 JB |
1 | #include <stdlib.h> |
2 | #include <stdio.h> | |
5df3071e | 3 | #include <string.h> |
7515f897 JB |
4 | #include <ncurses.h> |
5 | ||
6 | #include "display.h" | |
5df3071e | 7 | #include "coordinates.h" |
7515f897 JB |
8 | |
9 | int main() { | |
10 | int row, col; | |
5df3071e JB |
11 | char* top_msg = ""; |
12 | char* back_msg = ""; | |
7515f897 JB |
13 | |
14 | initscr(); | |
5df3071e | 15 | getmaxyx(stdscr, row, col); |
7515f897 JB |
16 | noecho(); |
17 | curs_set(0); | |
18 | ||
5df3071e JB |
19 | /* array of the active coordinates in the entered order */ |
20 | coordinates_t coordinates_array[MAX_COORDINATES]; | |
21 | init_coordinates(coordinates_array); | |
22 | ||
7515f897 | 23 | /* center base coordinates for the board */ |
5df3071e JB |
24 | int base_y = row/2 - 4; |
25 | int base_x = col/2 - 7; | |
7515f897 | 26 | |
5df3071e | 27 | if (!top_msg) mvprintw(base_y - 2, (base_x + 7 - strlen(top_msg)/2), top_msg); |
7515f897 | 28 | print_board(base_y, base_x); |
5df3071e JB |
29 | if (!back_msg) mvprintw(base_y + 10, (base_x + 7 - strlen(back_msg)/2), back_msg); |
30 | ||
31 | int errno = add_coordinates(set_coordinates(1, 3, 0), coordinates_array); | |
32 | errno = add_coordinates(set_coordinates(1, 3, 0), coordinates_array); | |
33 | errno = add_coordinates(set_coordinates(2, 3, 1), coordinates_array); | |
34 | errno = add_coordinates(set_coordinates(1, 1, 0), coordinates_array); | |
7515f897 | 35 | |
5df3071e | 36 | print_coordinates(coordinates_array, base_y, base_x); |
7515f897 JB |
37 | |
38 | refresh(); | |
39 | ||
40 | while (getch() != 'q'); | |
41 | ||
42 | endwin(); | |
43 | ||
44 | exit(EXIT_SUCCESS); | |
45 | } |