MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / DrawSolidConsole

Method DrawSolidConsole

neo/framework/Console.cpp:1103–1201  ·  view source on GitHub ↗

================ DrawSolidConsole Draws the console with the solid background ================ */

Source from the content-addressed store, hash-verified

1101================
1102*/
1103void idConsoleLocal::DrawSolidConsole( float frac ) {
1104 int i, x;
1105 float y;
1106 int rows;
1107 short *text_p;
1108 int row;
1109 int lines;
1110 int currentColor;
1111
1112 lines = idMath::FtoiFast( SCREEN_HEIGHT * frac );
1113 if ( lines <= 0 ) {
1114 return;
1115 }
1116
1117 if ( lines > SCREEN_HEIGHT ) {
1118 lines = SCREEN_HEIGHT;
1119 }
1120
1121 // draw the background
1122 y = frac * SCREEN_HEIGHT - 2;
1123 if ( y < 1.0f ) {
1124 y = 0.0f;
1125 } else {
1126 renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, y, 0, 1.0f - displayFrac, 1, 1, consoleShader );
1127 }
1128
1129 renderSystem->SetColor( colorCyan );
1130 renderSystem->DrawStretchPic( 0, y, SCREEN_WIDTH, 2, 0, 0, 0, 0, whiteShader );
1131 renderSystem->SetColor( colorWhite );
1132
1133 // draw the version number
1134
1135 renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CYAN ) );
1136
1137 idStr version = va("%s.%i", ENGINE_VERSION, BUILD_NUMBER);
1138 i = version.Length();
1139
1140 for ( x = 0; x < i; x++ ) {
1141 renderSystem->DrawSmallChar( SCREEN_WIDTH - ( i - x ) * SMALLCHAR_WIDTH,
1142 (lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), version[x], localConsole.charSetShader );
1143
1144 }
1145
1146
1147 // draw the text
1148 vislines = lines;
1149 rows = (lines-SMALLCHAR_WIDTH)/SMALLCHAR_WIDTH; // rows of text to draw
1150
1151 y = lines - (SMALLCHAR_HEIGHT*3);
1152
1153 // draw from the bottom up
1154 if ( display != current ) {
1155 // draw arrows to show the buffer is backscrolled
1156 renderSystem->SetColor( idStr::ColorForIndex( C_COLOR_CYAN ) );
1157 for ( x = 0; x < LINE_WIDTH; x += 4 ) {
1158 renderSystem->DrawSmallChar( (x+1)*SMALLCHAR_WIDTH, idMath::FtoiFast( y ), '^', localConsole.charSetShader );
1159 }
1160 y -= SMALLCHAR_HEIGHT;

Callers

nothing calls this directly

Calls 5

vaFunction · 0.85
DrawSmallCharMethod · 0.80
DrawStretchPicMethod · 0.45
SetColorMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected