1 | #include <ncurses.h> |
2 | #include <stdio.h> |
3 | #include <stdlib.h> |
4 |
|
5 | #include "draw/draw.h" |
6 | #include "state.h" |
7 |
|
8 | int main(void) { |
9 | printf("ncurses-minesweeper Copyright (c) Joshua 'joshuas3' Stockin 2020\n"); |
10 | printf("<https://joshstock.in>\n"); |
11 | printf("<https://github.com/JoshuaS3/ncurses-minesweeper>\n\n"); |
12 |
|
13 | printf("Initializing game state\n"); |
14 | game_state *state = calloc(1, sizeof(game_state)); |
15 | state->page = Title; |
16 | state->page_selection = 0; |
17 | game_board *board = calloc(1, sizeof(game_board)); |
18 | state->board = board; |
19 | state->board->width = 30; |
20 | state->board->height = 16; |
21 | state->board->mine_count = 99; |
22 |
|
23 | printf("Initializing ncurses\n"); |
24 |
|
25 | initscr(); |
26 | noecho(); |
27 | cbreak(); |
28 | curs_set(0); |
29 |
|
30 | draw(state, 0); // draw initial window |
31 | draw_loop(state); // enter control input loop |
32 |
|
33 | endwin(); |
34 |
|
35 | return 0; |
36 | } |
37 |
|