Index

ncurses-minesweeper / 3345b60

Terminal game of Minesweeper, implemented in C with ncurses.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1212 Sep 2020 16:199e98a79Create game loop and page structureJosh Stockin1237G

Blob @ ncurses-minesweeper / src / main.c

text/plain776 bytesdownload raw
1#include <ncurses.h>
2#include <stdio.h>
3#include <stdlib.h>
4
5#include "draw/draw.h"
6#include "state.h"
7
8int 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 = 'A';
17 game_board *board = calloc(1, sizeof(game_board));
18 state->board = board;
19
20 printf("Initializing ncurses\n");
21
22 initscr();
23 noecho();
24 cbreak();
25 curs_set(0);
26
27 draw(state, 0); // draw initial window
28 draw_loop(state); // enter control input loop
29
30 endwin();
31
32 return 0;
33}
34