Browse Source

engine: client: font: add CL_DrawStringf wrapper

pull/2/head
Alibek Omarov 2 years ago
parent
commit
5ea5e1167b
  1. 12
      engine/client/cl_font.c
  2. 1
      engine/client/client.h

12
engine/client/cl_font.c

@ -260,6 +260,18 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon @@ -260,6 +260,18 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
return draw_len;
}
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... )
{
va_list va;
char buf[MAX_VA_STRING];
va_start( va, fmt );
Q_vsnprintf( buf, sizeof( buf ), fmt, va );
va_end( va );
return CL_DrawString( x, y, buf, color, font, flags );
}
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height )
{
if( !font || !font->valid ) return;

1
engine/client/client.h

@ -817,6 +817,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon @@ -817,6 +817,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
void CL_DrawStringLen( cl_font_t *font, const char *s, int *width, int *height, int flags );
int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags, const char *fmt, ... ) _format( 6 );
//

Loading…
Cancel
Save