summaryrefslogtreecommitdiffstats
path: root/src/client/client.cpp
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2020-11-25 00:18:43 +0300
committerJoursoir <chat@joursoir.net>2020-11-25 00:18:43 +0300
commit8dfca4755430209504dac5ed2e03a482342265b3 (patch)
tree393265d9d67a18b1bda32ea4f39d6dd4805cb35e /src/client/client.cpp
parentcd2decce51c32b8c0531a87ea849e9f8e80db0d3 (diff)
downloadwant-chat-8dfca4755430209504dac5ed2e03a482342265b3.tar.gz
want-chat-8dfca4755430209504dac5ed2e03a482342265b3.tar.bz2
want-chat-8dfca4755430209504dac5ed2e03a482342265b3.zip
client: remove menu, all actions move to chat, fix chat move
Diffstat (limited to 'src/client/client.cpp')
-rw-r--r--src/client/client.cpp63
1 files changed, 6 insertions, 57 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 8ad25d8..8f6a9ff 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -1,45 +1,18 @@
#include <ncurses.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "user.hpp"
-#define EXIT_BUTTON 4
#define SERVER_IP "127.0.0.1"
-static int port = 7777;
-
-int showMainMenu(int max_row, int max_col)
-{
- int num_items = 5;
- const char *items[num_items] = {
- "Connect to room",
- "Create room",
- "Help",
- "About WantChat",
- "Exit"
- };
-
- int height_menu = num_items + 2;
- int width_menu = strlen(items[0]) + 2;
-
- SelectionMenu main_menu = SelectionMenu("Hello. Welcome to \
- WantChat", items, num_items, height_menu, width_menu,
- (max_row-height_menu)/2, (max_col-width_menu)/2, 0);
- main_menu.Update();
-
- keypad(main_menu.GetWindow(), true);
- int choice = main_menu.Handling();
- main_menu.Hide();
- return choice;
- // дескриптор будет вызван после выхода из функции неявно
-}
+static int port = 3030;
int main(int argc, char *argv[])
{
initscr();
cbreak();
noecho();
- // keypad(stdscr, TRUE);
curs_set(false);
int rows, columns;
@@ -57,34 +30,10 @@ int main(int argc, char *argv[])
return 1;
}
- int choice;
- while( (choice = showMainMenu(rows, columns)) != EXIT_BUTTON)
- {
- switch(choice)
- {
- case 0: {
- ChatRoom *room = new ChatRoom();
- user->Run(room);
-
- delete room;
- break;
- }
- }
- }
+ ChatRoom *room = new ChatRoom();
+ user->Run(room);
+ delete room;
endwin();
return 0;
-}
-
- /*WINDOW *chat = newwin(21, 59, 0, 0);
- box(chat, 0, 0);
- wrefresh(chat);
-
- WINDOW *players = newwin(21, 20, 0, 60);
- box(players, 0, 0);
- wrefresh(players);
-
- WINDOW *input = newwin(2, 80, 22, 0);
- //box(input, ' ', ' ');
- wmove(input, 0, 2);
- wrefresh(input);*/ \ No newline at end of file
+} \ No newline at end of file