summaryrefslogtreecommitdiffstats
path: root/src/client_clui/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client_clui/client.cpp')
-rw-r--r--src/client_clui/client.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/client_clui/client.cpp b/src/client_clui/client.cpp
new file mode 100644
index 0000000..83f8ef0
--- /dev/null
+++ b/src/client_clui/client.cpp
@@ -0,0 +1,35 @@
+#include <ncurses.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "../config.hpp"
+#include "user.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 = Client::Start(SERVER_IP, SERVER_PORT);
+ if(!user) {
+ endwin();
+ perror("server");
+ return 1;
+ }
+
+ ChatRoom *room = new ChatRoom();
+ user->Run(room);
+ delete room;
+
+ endwin();
+ return 0;
+} \ No newline at end of file