Updated Textbox to look nicer
This commit is contained in:
3
ct.1
3
ct.1
@@ -20,3 +20,6 @@ to initiate a session and the other for a "client" user to join the host.
|
||||
|
||||
.LP
|
||||
Messages are sent as buffered plain text with minimal processing, if any.
|
||||
|
||||
.LP
|
||||
The program is intialized in server mode and waits for a client the send a message in the textbox
|
||||
|
||||
28
main.cc
28
main.cc
@@ -105,6 +105,23 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
while (!exit) {
|
||||
clear();
|
||||
|
||||
//Draw outer chat border
|
||||
box(stdscr, 0, 0);
|
||||
|
||||
// Get screen size
|
||||
int height, width;
|
||||
getmaxyx(stdscr, height, width);
|
||||
|
||||
// Draw separator line above input
|
||||
mvhline(height - 3, 1, 0, width - 2);
|
||||
|
||||
// Labels
|
||||
mvprintw(0, 2, " Chat ");
|
||||
mvprintw(height - 3, 2, " Input ");
|
||||
|
||||
//Display Chat Log
|
||||
displayFile(logFileName, linePos, LOG_LENGTH);
|
||||
|
||||
// scroll along the screen if and when required so that it stays
|
||||
@@ -112,10 +129,13 @@ main(int argc, char *argv[])
|
||||
if (linesInFile(logFileName) > LOG_LENGTH)
|
||||
linePos++;
|
||||
|
||||
/* clear message box / reset cursor */
|
||||
move(12, 0);
|
||||
printw(">\t\t\t");
|
||||
move(12, 2);
|
||||
// Input area
|
||||
move(height - 2, 2);
|
||||
clrtoeol();
|
||||
printw("You: ");
|
||||
move(height - 2, 7);
|
||||
|
||||
refresh();
|
||||
|
||||
getstr(userInput);
|
||||
writeToFile(logFileName, userInput);
|
||||
|
||||
Reference in New Issue
Block a user