int CCmdDoomFont(int argc, char **argv) { ddfont_t cfont; cfont.flags = DDFONT_WHITE; cfont.height = 8; cfont.sizeX = 1.5f; cfont.sizeY = 2; cfont.TextOut = ConTextOut; cfont.Width = ConTextWidth; cfont.Filter = ConTextFilter; Con_SetFont(&cfont); return true; }
/* =========== NetGraph_DrawTextFields =========== */ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, float avg, int packet_loss, int packet_choke ) { static int lastout; rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 }; int ptx = max( x + w - NETGRAPH_LERP_HEIGHT - 1, 1 ); int pty = max( rect.top + rect.bottom - NETGRAPH_LERP_HEIGHT - 3, 1 ); int out, i = ( cls.netchan.outgoing_sequence - 1 ) & NET_TIMINGS_MASK; int j = cls.netchan.incoming_sequence & NET_TIMINGS_MASK; int last_y = y - net_graphheight->value; if( count > 0 ) { avg = avg / (float)( count - ( host.frametime * FRAMERATE_AVG_FRAC )); if( cl_updaterate->value > 0.0f ) avg -= 1000.0f / cl_updaterate->value; // can't be below zero avg = max( 0.0, avg ); } else avg = 0.0; // move rolling average framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0 - FRAMERATE_AVG_FRAC ) * framerate; Con_SetFont( 0 ); if( framerate > 0.0f ) { y -= net_graphheight->value; Con_DrawString( x, y, va( "%.1f fps" , 1.0f / framerate ), colors ); if( avg > 1.0f ) Con_DrawString( x + 75, y, va( "%i ms" , (int)avg ), colors ); y += 15; out = netstat_cmdinfo[i].size; if( !out ) out = lastout; else lastout = out; Con_DrawString( x, y, va( "in : %i %.2f k/s", netstat_graph[j].msgbytes, cls.netchan.flow[FLOW_INCOMING].avgkbytespersec ), colors ); y += 15; Con_DrawString( x, y, va( "out: %i %.2f k/s", out, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec ), colors ); y += 15; if( net_graph->value > 2 ) { int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01 ); int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01 ); Con_DrawString( x, y, va( "loss: %i choke: %i", loss, choke ), colors ); } } if( net_graph->value < 3 ) Con_DrawString( ptx, pty, va( "%i/s", (int)cl_cmdrate->value ), colors ); Con_DrawString( ptx, last_y, va( "%i/s" , (int)cl_updaterate->value ), colors ); Con_RestoreFont(); }