summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
blob: 9ff09a6163c94ec0cf7854e3d771cb93a5a705db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include "game.hpp"

#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
    (void)argc;
    (void)argv;

    struct winsize w;
    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
    fcntl(STDIN_FILENO, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);

    Game::setup(w.ws_col, w.ws_row);

    while(Game::running()) {
        Game::turn();
    }

    Game::cleanup();
    return 0;
}