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
|
.LP
|
||||||
Messages are sent as buffered plain text with minimal processing, if any.
|
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) {
|
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);
|
displayFile(logFileName, linePos, LOG_LENGTH);
|
||||||
|
|
||||||
// scroll along the screen if and when required so that it stays
|
// 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)
|
if (linesInFile(logFileName) > LOG_LENGTH)
|
||||||
linePos++;
|
linePos++;
|
||||||
|
|
||||||
/* clear message box / reset cursor */
|
// Input area
|
||||||
move(12, 0);
|
move(height - 2, 2);
|
||||||
printw(">\t\t\t");
|
clrtoeol();
|
||||||
move(12, 2);
|
printw("You: ");
|
||||||
|
move(height - 2, 7);
|
||||||
|
|
||||||
|
refresh();
|
||||||
|
|
||||||
getstr(userInput);
|
getstr(userInput);
|
||||||
writeToFile(logFileName, userInput);
|
writeToFile(logFileName, userInput);
|
||||||
|
|||||||
Reference in New Issue
Block a user