engine/EngineConsole.c
/*	Draws the console with the solid background
	The typing input line at the bottom should only be drawn if typing is allowed
*/
Draws the console with the solid background
The typing input line at the bottom should only be drawn if typing is allowed
Draws the console with the solid background The typing input line at the bottom should only be drawn if typing is allowed
void Con_DrawConsole(int lines, bool drawinput)
{
	int		i,x,y,j,sb,rows;
	char	ver[64],*text;
	if(lines <= 0)
		return;
	con_vislines = lines*vid.conheight/glheight;
	Draw_ConsoleBackground();
	GL_SetCanvas(CANVAS_CONSOLE);
	rows = (con_vislines+7)/8;
	y = vid.conheight - rows*8;
	rows -= 2; 
	sb = (con_backscroll) ? 2 : 0;
	for (i = con_current - rows + 1 ; i <= con_current - sb ; i++, y+=8)
	{
		j = i - con_backscroll;
		if (j<0)
			j = 0;
		text = con_text + (j % con_totallines)*con_linewidth;
		for (x=0 ; x<con_linewidth ; x++)
			Draw_Character ( (x+1)<<3, y, text[x]);
	}
	if(con_backscroll)
	{
		y+=8; 
		for (x=0 ; x<con_linewidth ; x+=4)
			Draw_Character ((x+1)<<3, y, '^');
		y+=8;
	}
	if (drawinput)
		Con_DrawInput ();
	y += 8;
	sprintf(ver,"Katana (%i)", ENGINE_VERSION_BUILD);
	for(x = 0; x < (signed)strlen(ver); x++)
		Draw_Character((con_linewidth-strlen(ver)+x+2)<<3,y,ver[x]);
}
void Con_DrawConsole ( int lines , bool drawinput ) { int i , x , y , j , sb , rows ; char ver [ 64 ] , * text ; if ( lines <= 0 ) return ; con_vislines = lines * vid . conheight / glheight ; Draw_ConsoleBackground ( ) ; GL_SetCanvas ( CANVAS_CONSOLE ) ; rows = ( con_vislines + 7 ) / 8 ; y = vid . conheight - rows * 8 ; rows -= 2 ; sb = ( con_backscroll ) ? 2 : 0 ; for ( i = con_current - rows + 1 ; i <= con_current - sb ; i ++ , y += 8 ) { j = i - con_backscroll ; if ( j < 0 ) j = 0 ; text = con_text + ( j % con_totallines ) * con_linewidth ; for ( x = 0 ; x < con_linewidth ; x ++ ) Draw_Character ( ( x + 1 ) << 3 , y , text [ x ] ) ; } if ( con_backscroll ) { y += 8 ; for ( x = 0 ; x < con_linewidth ; x += 4 ) Draw_Character ( ( x + 1 ) << 3 , y , ' ' ) ; y += 8 ; } if ( drawinput ) Con_DrawInput ( ) ; y += 8 ; sprintf ( ver , " " , ENGINE_VERSION_BUILD ) ; for ( x = 0 ; x < ( signed ) strlen ( ver ) ; x ++ ) Draw_Character ( ( con_linewidth - strlen ( ver ) + x + 2 ) << 3 , y , ver [ x ] ) ; }
Draws the console with the solid background
The typing input line at the bottom should only be drawn if typing is allowed
Draws the console with the solid background The typing input line at the bottom should only be drawn if typing is allowed
// Draw the background // Draw the buffer text //for input and version lines // Draw scrollback arrows // blank line // draw the input prompt, user text, and cursor // Draw version number in bottom right