1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-01 16:07:50 +02:00

use faster draw methods for formatting codes

This commit is contained in:
Ell 2024-04-10 20:33:53 +02:00
parent 9a03a8c62d
commit 76eb5d0679
2 changed files with 2 additions and 2 deletions

View file

@ -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;
}

View file

@ -20,7 +20,7 @@ namespace MLEM.Formatting.Codes {
/// <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;
}