private int DrawText(float x, float y, float scale, Vector4 color, string text, float adjust, int limit, int style, int cursor)
{
SetFontByScale(scale);
float useScale = scale * _currentFont.GlyphScale;
int count = 0;
idFontGlyph glyph;
if((text != string.Empty) && (color.W != 0.0f))
{
char c, c2;
int textPosition = 0;
int length = text.Length;
Vector4 newColor = color;
idE.RenderSystem.Color = color;
if((limit > 0) && (length > limit))
{
length = limit;
}
while(((c = idHelper.GetBufferCharacter(text, textPosition)) != '\0') && (count < length))
{
if((c < idE.GlyphStart) || (c > idE.GlyphEnd))
{
textPosition++;
c = idHelper.GetBufferCharacter(text, textPosition);
continue;
}
glyph = _currentFont.Glyphs[c];
if(idHelper.IsColor(text, textPosition) == true)
{
c2 = idHelper.GetBufferCharacter(text, textPosition + 1);
if(c2 == (int) idColorIndex.Default)
{
newColor = color;
}
else
{
newColor = idHelper.ColorForIndex(c2);
}
if((cursor == count) || (cursor == (count + 1)))
{
float partialSkip = ((glyph.SkipX * useScale) + adjust) / 5.0f;
if(cursor == count)
{
partialSkip *= 2.0f;
}
else
{
idE.RenderSystem.Color = newColor;
}
// TODO: DrawEditCursor(x - partialSkip, y, scale);
}
idE.RenderSystem.Color = newColor;
textPosition += 2;
count += 2;
c = idHelper.GetBufferCharacter(text, textPosition);
continue;
}
else
{
float adjustY = useScale * glyph.Top;
PaintCharacter(x, y - adjustY, glyph.ImageWidth, glyph.ImageHeight, useScale, glyph.S, glyph.T, glyph.S2, glyph.T2, glyph.Glyph);
/* TODO: if(cursor == count)
{
// TODO: DrawEditCursor(x, y, scale);
}*/
x += (glyph.SkipX * useScale) + adjust;
textPosition++;
count++;
c = idHelper.GetBufferCharacter(text, textPosition);
}
}
if(cursor == length)
{
// TODO: DrawEditCursor(x, y, scale);
}
}
return count;
}