public static void Draw(QFont font, string text, QFontAlignment alignment, Vector2 position) { position.Y -= font.Measure(text, alignment).Height / 2; font.Options.UseDefaultBlendFunction = false; font.Print(text, alignment, position); }
private void PrintCommentWithLine(QFont font, string comment, QFontAlignment alignment, float xOffset, ref float yOffset) { GL.PushMatrix(); yOffset += 20; GL.Translate((int)xOffset, yOffset, 0f); font.Print(comment, alignment); var bounds = font.Measure(comment, Width-60, alignment); GL.Disable(EnableCap.Texture2D); GL.Begin(BeginMode.Lines); GL.Color4(1.0f, 0f, 0f, 1f); GL.Vertex2(0f, 0f); GL.Color4(1.0f, 0f, 0f, 1f); GL.Vertex2(0f, bounds.Height + 20f); GL.End(); yOffset += bounds.Height; GL.PopMatrix(); }
private void PrintWithBounds(QFont font, string text, RectangleF bounds, QFontAlignment alignment, ref float yOffset) { GL.Disable(EnableCap.Texture2D); GL.Color4(1.0f, 0f, 0f, 1.0f); float maxWidth = bounds.Width; float height = font.Measure(text, maxWidth, alignment).Height; GL.Begin(BeginMode.LineLoop); GL.Vertex3(bounds.X, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y + height, 0f); GL.Vertex3(bounds.X, bounds.Y + height, 0f); GL.End(); font.Print(text, maxWidth, alignment, new Vector2(bounds.X,bounds.Y)); yOffset += height; }
private void PrintComment(QFont font, string comment,QFontAlignment alignment, ref float yOffset){ GL.PushMatrix(); yOffset += 20; GL.Translate(30f, yOffset, 0f); font.Print(comment, Width - 60, alignment); yOffset += font.Measure(comment, Width - 60, alignment).Height; GL.PopMatrix(); }
private void PrintWithBounds(QFont font, string text, RectangleF bounds, QFontAlignment alignment, ref float yOffset) { GL.Disable(EnableCap.Texture2D); GL.Color4(1.0f, 0f, 0f, 1.0f); float maxWidth = bounds.Width; float height = font.Measure(text, maxWidth, alignment).Height; GL.Begin(BeginMode.LineLoop); GL.Vertex3(bounds.X, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y, 0f); GL.Vertex3(bounds.X + bounds.Width, bounds.Y + height, 0f); GL.Vertex3(bounds.X, bounds.Y + height, 0f); GL.End(); font.Print(text, maxWidth, alignment, new Vector2(bounds.X, bounds.Y)); // Print ENTER string s = "[ Press Enter ]"; font.Print(s, maxWidth, alignment, new Vector2(-bounds.X - (font.Measure(s).Width + 10), bounds.Height + 2 * font.Measure(text).Height)); //font.Print(s, maxWidth, QFontAlignment.Right, new Vector2(bounds.X + bounds.Width - font.Measure(s).Height, bounds.Y + bounds.Height - font.Measure(s).Height)); yOffset += height; }