added some more comments and "clearscreen" to clients view of console

master
Bartosz Kostrzewa 2011-05-08 19:19:13 +02:00
parent a2a6a0dc7d
commit 5fce1272e5
2 changed files with 7 additions and 2 deletions

View File

@ -99,6 +99,7 @@ void Server::listen()
packetcounter++; packetcounter++;
// copy frame information into the buffer
frame.z = recv_buf[0]; frame.z = recv_buf[0];
for(int i = 0; i < HEIGHT; i++) for(int i = 0; i < HEIGHT; i++)
{ {
@ -438,13 +439,16 @@ void Server::console_printframe_values(frame_t _frame)
} }
} }
// print the list of clients connected to the server
void Server::console_printclients() void Server::console_printclients()
{ {
int rows, cols, offset=0; int rows, cols, offset=0;
getmaxyx(stdscr,rows,cols); getmaxyx(stdscr,rows,cols);
clrtobot();
for(int i = 0; i < buffers.size(); i++) for(int i = 0; i < buffers.size(); i++)
{ {
if(i >= 1 && i%(rows-2)==0) // rows-2 because there is a header
if(i > 0 && i%(rows-2)==0)
offset += 27; offset += 27;
if( offset + 27 < cols ) if( offset + 27 < cols )
mvprintw(i%(rows-2)+2,offset,"(%3d) %s\n", i,buffers[i]->get_id().c_str() ); mvprintw(i%(rows-2)+2,offset,"(%3d) %s\n", i,buffers[i]->get_id().c_str() );

View File

@ -1,7 +1,8 @@
#ifndef __DEFINES_H_ #ifndef __DEFINES_H_
#define __DEFINES_H_ #define __DEFINES_H_
// four minutes should be enough // four minutes should be enough (seconds)
// timeout set to two seconds for testing purposes
#define BUFTIMEOUT 2 #define BUFTIMEOUT 2
#define NUMBUFS 1000 #define NUMBUFS 1000