private void WriteComment(NxFont font, string comment,QFontAlignment alignment, ref float yOffset) { //GL.PushMatrix(); yOffset += 20; var offset = new Vector3(30f, yOffset, 0f); var transform = Matrix4.CreateTranslation(offset); var mvp = Matrix4.Mult (transform, mOrthographicMatrix); font.SafePrint(mvp, ClientRectangle, comment, Width - 60, alignment); yOffset += font.SafeMeasure(ClientRectangle, comment, Width - 60, alignment).Height; //GL.PopMatrix(); }
private void WriteCommentWithLine(NxFont font, string comment, QFontAlignment alignment, float xOffset, ref float yOffset) { //GL.PushMatrix(); yOffset += 20; var offset = new Vector3((int)xOffset, yOffset, 0f); var transform = Matrix4.CreateTranslation(offset); var mvp = Matrix4.Mult (transform, mOrthographicMatrix); font.Print(mvp, comment, alignment); var bounds = font.SafeMeasure(ClientRectangle, 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(NxFont 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.SafeMeasure(ClientRectangle, 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.PrintAt(ClientRectangle, text, maxWidth, alignment, new Vector2(bounds.X,bounds.Y)); yOffset += height; }