summaryrefslogtreecommitdiffstats
path: root/src/client/clui/main.cpp
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2020-12-09 19:34:04 +0000
committerJoursoir <chat@joursoir.net>2020-12-09 19:34:04 +0000
commit4131de177e36b19b20b8bbdb7bd43b18b6e22690 (patch)
tree7540050cbe152fc1257585f4fd30cf9b020508c0 /src/client/clui/main.cpp
parent1baf22ad58cc1a9aa9089ca9a09fc80a453cb3c9 (diff)
downloadwant-chat-4131de177e36b19b20b8bbdb7bd43b18b6e22690.tar.gz
want-chat-4131de177e36b19b20b8bbdb7bd43b18b6e22690.tar.bz2
want-chat-4131de177e36b19b20b8bbdb7bd43b18b6e22690.zip
clui: architecture go to base class for clients; fix bugs
Diffstat (limited to 'src/client/clui/main.cpp')
-rw-r--r--src/client/clui/main.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/client/clui/main.cpp b/src/client/clui/main.cpp
new file mode 100644
index 0000000..fd77708
--- /dev/null
+++ b/src/client/clui/main.cpp
@@ -0,0 +1,37 @@
+#include <ncurses.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "../../config.hpp"
+#include "Client.hpp"
+#include "clui.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;
+ }
+
+ ChatRoom *room = new ChatRoom();
+ Client *user = new Client(SERVER_IP, SERVER_PORT, room);
+ if(user->ConstuctorError()) {
+ endwin();
+ perror("server");
+ return 1;
+ }
+
+ while(user->Run());
+ delete room;
+ delete user;
+
+ endwin();
+ return 0;
+} \ No newline at end of file