From 76eb5d06798fd49dbcba364684d6f451242a2743 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 10 Apr 2024 20:33:53 +0200 Subject: [PATCH] use faster draw methods for formatting codes --- MLEM/Formatting/Codes/OutlineCode.cs | 2 +- MLEM/Formatting/Codes/ShadowCode.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM/Formatting/Codes/OutlineCode.cs b/MLEM/Formatting/Codes/OutlineCode.cs index e5cb6d7..1b8be7b 100644 --- a/MLEM/Formatting/Codes/OutlineCode.cs +++ b/MLEM/Formatting/Codes/OutlineCode.cs @@ -26,7 +26,7 @@ namespace MLEM.Formatting.Codes { foreach (var dir in this.diagonals ? Direction2Helper.AllExceptNone : Direction2Helper.Adjacent) { var offset = Vector2.Normalize(dir.Offset().ToVector2()) * this.thickness; var finalPos = font.TransformSingleCharacter(stringPos, charPosOffset + offset, rotation, origin, scale, effects, stringSize, charSize); - font.DrawString(batch, character, finalPos, this.color.CopyAlpha(color), rotation, Vector2.Zero, scale, effects, depth); + font.DrawCharacter(batch, codePoint, character, finalPos, this.color.CopyAlpha(color), rotation, scale, effects, depth); } return false; } diff --git a/MLEM/Formatting/Codes/ShadowCode.cs b/MLEM/Formatting/Codes/ShadowCode.cs index bf849e8..dc36126 100644 --- a/MLEM/Formatting/Codes/ShadowCode.cs +++ b/MLEM/Formatting/Codes/ShadowCode.cs @@ -20,7 +20,7 @@ namespace MLEM.Formatting.Codes { /// public override bool DrawCharacter(GameTime time, SpriteBatch batch, int codePoint, string character, Token token, int indexInToken, Vector2 stringPos, ref Vector2 charPosOffset, GenericFont font, ref Color color, ref Vector2 scale, ref float rotation, ref Vector2 origin, float depth, SpriteEffects effects, Vector2 stringSize, Vector2 charSize) { var finalPos = font.TransformSingleCharacter(stringPos, charPosOffset + this.offset, rotation, origin, scale, effects, stringSize, charSize); - font.DrawString(batch, character, finalPos, this.color.CopyAlpha(color), rotation, Vector2.Zero, scale, effects, depth); + font.DrawCharacter(batch, codePoint, character, finalPos, this.color.CopyAlpha(color), rotation, scale, effects, depth); // we return false since we still want regular drawing to occur return false; }