public void RenderCoordinates() { Font coordinateFont = new Font(fontName, BlockSize / 2, 0); Font coordinateFont2 = new Font(fontName, BlockSize / 2, FontStyle.Bold); for (int x = 0; x < State.Width; x++) { Vector2f p = GameToImage(x, -0.5f); Vector2f p2 = GameToImage(x, State.Height - 1 + 0.6f); char c = (char)('A' + x); if (c >= 'I')//no I displayed c++; string s = c.ToString(); Font font = coordinateFont; if (active != null && active.Value.X == x) font = coordinateFont2; DrawString(s, font, RawColor.Black, p, new Vector2f(0.5f, 1f)); DrawString(s, font, RawColor.Black, p2, new Vector2f(0.5f, 0f)); } for (int y = 0; y < State.Width; y++) { Vector2f p = GameToImage(-0.6f, y); Vector2f p2 = GameToImage(State.Width - 1 + 1.2f, y); string s = (State.Height - y).ToString(); Font font = coordinateFont; if (active != null && active.Value.Y == y) font = coordinateFont2; DrawString(s, font, RawColor.Black, p, new Vector2f(1f, 0.5f)); DrawString(s, font, RawColor.Black, p2, new Vector2f(1f, 0.5f)); } }
private void GenerateFonts() { for (int i = 0; i < fonts.Length; i++) { fonts[i] = new Font(fontName, BlockSize / (i + 2) * 1.5f, FontStyle.Bold); } }
public abstract Vector2f MeasureString(string text, Font font);
public abstract void DrawString(string text, Font font, RawColor color, Vector2f position);
public void DrawString(string s, Font font, RawColor color, Vector2f point, Vector2f align) { Vector2f size = Graphics.MeasureString(s, font); Vector2f newPoint = new Vector2f(point.X - size.X * align.X, point.Y - size.Y * align.Y); Graphics.DrawString(s, font, color, newPoint); }