Esempio n. 1
0
/*
==================
idRenderSystemLocal::DrawSmallString[Color]

Draws a multi-colored string with a drop shadow, optionally forcing
to a fixed color.

Coordinates are at 640 by 480 virtual resolution
==================
*/
void idRenderSystemLocal::DrawSmallStringExt( int x, int y, const char *string, const idVec4 &setColor, bool forceColor, const idMaterial *material ) {
	idVec4		color;
	const unsigned char	*s;
	int			xx;

	// draw the colored text
	s = (const unsigned char*)string;
	xx = x;
	SetColor( setColor );
	while ( *s ) {
		if ( idStr::IsColor( (const char*)s ) ) {
			if ( !forceColor ) {
				if ( *(s+1) == C_COLOR_DEFAULT ) {
					SetColor( setColor );
				} else {
					color = idStr::ColorForIndex( *(s+1) );
					color[3] = setColor[3];
					SetColor( color );
				}
			}
			s += 2;
			continue;
		}
		DrawSmallChar( xx, y, *s, material );
		xx += SMALLCHAR_WIDTH;
		s++;
	}
	SetColor( colorWhite );
}
Esempio n. 2
0
int Statbar::DrawFontString(char* s,int x,int y,float f){
	int c;
	for(c=0;c<strlen(s);c++){
		if('0'<=s[c] && s[c]<='9'){
			x+=DrawNum(s[c]-'0',x,y,f);
		}else if('a'<=s[c] && s[c]<='z'){
			x+=DrawSmallChar(s[c]-'a',x,y,f);
		}else if('A'<=s[c] && s[c]<='Z'){
			x+=DrawLargeChar(s[c]-'A',x,y,f);
		}else{
			x+=NUM_WID*0.8f*f;
		}
	}
	return 0;
}