engine: make pfnDrawString & pfnDrawStringReverse return width

This commit is contained in:
Bien Pham 2022-01-29 04:03:00 +07:00 committed by a1batross
parent 89baa633c8
commit 3a55b9cd67

View File

@ -2929,15 +2929,16 @@ pfnDrawString
*/ */
static int GAME_EXPORT pfnDrawString( int x, int y, const char *str, int r, int g, int b ) static int GAME_EXPORT pfnDrawString( int x, int y, const char *str, int r, int g, int b )
{ {
int iWidth = 0;
Con_UtfProcessChar(0); Con_UtfProcessChar(0);
// draw the string until we hit the null character or a newline character // draw the string until we hit the null character or a newline character
for ( ; *str != 0 && *str != '\n'; str++ ) for ( ; *str != 0 && *str != '\n'; str++ )
{ {
x += pfnVGUI2DrawCharacterAdditive( x, y, (unsigned char)*str, r, g, b, 0 ); iWidth += pfnVGUI2DrawCharacterAdditive( x + iWidth, y, (unsigned char)*str, r, g, b, 0 );
} }
return x; return iWidth;
} }
/* /*
@ -2952,8 +2953,7 @@ static int GAME_EXPORT pfnDrawStringReverse( int x, int y, const char *str, int
char *szIt; char *szIt;
for( szIt = (char*)str; *szIt != 0; szIt++ ) for( szIt = (char*)str; *szIt != 0; szIt++ )
x -= clgame.scrInfo.charWidths[ (unsigned char) *szIt ]; x -= clgame.scrInfo.charWidths[ (unsigned char) *szIt ];
pfnDrawString( x, y, str, r, g, b ); return pfnDrawString( x, y, str, r, g, b );
return x;
} }
/* /*