summaryrefslogtreecommitdiffstats
path: root/src/client/clui/main.cpp
blob: 876e6f92c55382545736c0c865763ddcc63ab529 (plain)
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
27
28
29
30
31
32
33
34
#include <ncurses.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "../../config.hpp"
#include "Client.hpp"

int main(int argc, char *argv[])
{
	initscr();
	noecho();

	int rows, columns;
	getmaxyx(stdscr, rows, columns); 
	if(rows != 24 || columns != 80) {
		endwin();
		printf("Please use terminal with size 24x80\n");
		return 1;
	}

	Client *user = new Client(SERVER_IP, SERVER_PORT);
	if(user->ConstuctorError()) {
		endwin();
		perror("server");
		return 1;
	}

	while(user->Run());
	delete user;

	endwin();
	return 0;
}