private static void DrawChar(Point position, byte[] charData, TileFont.DrawMode mode) { if (mode.HasBackground) { for (int index1 = -1; index1 < charData.Length + 1; ++index1) { for (int index2 = -1; index2 < 6; ++index2) { Main.tile[position.X + index2, position.Y + index1].ResetToType(mode.BackgroundTile); WorldGen.TileFrame(position.X + index2, position.Y + index1, false, false); } } } for (int index1 = 0; index1 < charData.Length; ++index1) { int num = (int)charData[index1] << 1; for (int index2 = 0; index2 < 5; ++index2) { if ((num & 128) == 128) { Main.tile[position.X + index2, position.Y + index1].ResetToType(mode.ForegroundTile); WorldGen.TileFrame(position.X + index2, position.Y + index1, false, false); } num <<= 1; } } }
public static void DrawString(Point start, string text, TileFont.DrawMode mode) { Point position = start; foreach (char key in text) { if (key == '\n') { position.X = start.X; position.Y += 6; } byte[] charData; if (TileFont.MicroFont.TryGetValue(key, out charData)) { TileFont.DrawChar(position, charData, mode); position.X += 6; } } }