Skip to content

Commit

Permalink
use faster draw methods for formatting codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Apr 10, 2024
1 parent 9a03a8c commit 76eb5d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MLEM/Formatting/Codes/OutlineCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override bool DrawCharacter(GameTime time, SpriteBatch batch, int codePoi
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;
}
Expand Down
2 changes: 1 addition & 1 deletion MLEM/Formatting/Codes/ShadowCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ShadowCode(Match match, Regex regex, Color color, Vector2 offset) : base(
/// <inheritdoc />
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;
}
Expand Down

0 comments on commit 76eb5d0

Please sign in to comment.