summaryrefslogtreecommitdiffstats
path: root/src/client/client.cpp
blob: 7f092ccb7063fca7fa8caa66293551c189049131 (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
35
36
37
38
#include <ncurses.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "user.hpp"

#define SERVER_IP "127.0.0.1"
static int port = 3030;

int main(int argc, char *argv[])
{
	initscr();
	//raw();
	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 = Client::Start(SERVER_IP, port);
	if(!user) {
		endwin();
		perror("client");
		return 1;
	}

	ChatRoom *room = new ChatRoom();
	user->Run(room);
	delete room;

	endwin();
	return 0;
}