sneak/Shared/Text.cs

22 lines
677 B
C#
Raw Permalink Normal View History

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace SemiColinGames {
2020-03-09 16:22:33 +00:00
public static class Text {
// Outlined text in black.
public static void DrawOutlined(
SpriteBatch spriteBatch, SpriteFont font, string text, Vector2 position, Color color) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (i == 0 && j == 0) {
continue;
}
Vector2 stencilPos = new Vector2(position.X + i, position.Y + j);
spriteBatch.DrawString(font, text, stencilPos, Color.Black);
}
}
spriteBatch.DrawString(font, text, position, color);
}
}
}