public void Draw() { if (!IsEnabled) { return; } debugBatch.Begin(1f, blendState: BlendState.NonPremultiplied); //scale=1f is ok because we use no textures foreach (var line in lines.SelectMany(p => p.GetLines()).Where(p => p.Active())) { var columns = line.DisplayText(); var pos = new FPoint(TEXT_OFFSET * Scale, line.PositionY * Scale); if (columns.Count == 0 || columns.All(string.IsNullOrWhiteSpace)) { continue; } foreach (var _text in columns) { var text = FontRenderHelper.MakeTextSafeWithWarn(font, _text, '_'); var size = font.MeasureString(text) * Scale; var bg = line.Background; if (bg.A == 255) { bg = ColorMath.Fade(line.Background, line.Decay * backgroundAlpha); } debugBatch.FillRectangle( new FRectangle(pos.X - TEXT_OFFSET * Scale, pos.Y, size.X + 2 * TEXT_OFFSET * Scale, size.Y), bg); debugBatch.DrawString( font, text, pos, ColorMath.Fade(line.Color, line.Decay), 0, FPoint.Zero, Scale, SpriteEffects.None, 0); pos = new FPoint(pos.X + 3 * TEXT_OFFSET * Scale + size.X, pos.Y); } } debugBatch.End(); }