Browse Source

engine: make pfnDrawString & pfnDrawStringReverse return width

pull/2/head
Bien Pham 3 years ago committed by a1batross
parent
commit
3a55b9cd67
  1. 8
      engine/client/cl_game.c

8
engine/client/cl_game.c

@ -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;
} }
/* /*

Loading…
Cancel
Save