public Vector MeasureFont(string text, double maxWidth = -1) { Vector dimensions = new Vector(); foreach(char c in text) { CharacterData data = Characters[c]; dimensions.X += data.XAdvance; dimensions.Y = System.Math.Max(dimensions.Y, data.Height + data.YOffset); } return dimensions; }
public void DrawImmediateModeVertex(Vector position, Color color, Point uvs) { GL.Color4(color.R, color.G, color.B, color.A); GL.TexCoord2(uvs.X, uvs.Y); GL.Vertex3(position.X, position.Y, position.Z); }
private void SetPosition(Vector position, double width, double height) { double halfWidth = width / 2; double halfHeight = height / 2; // Use clockwise rotation for Vertex positioning // TopLeft, TopRight, BottomLeft Vertices[0].Position = new Vector(position.X - halfWidth, position.Y + halfHeight, position.Z); Vertices[1].Position = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z); Vertices[2].Position = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z); // TopRight, BottomRight, BottomLeft Vertices[3].Position = new Vector(position.X + halfWidth, position.Y + halfHeight, position.Z); Vertices[4].Position = new Vector(position.X + halfWidth, position.Y - halfHeight, position.Z); Vertices[5].Position = new Vector(position.X - halfWidth, position.Y - halfHeight, position.Z); }
public void SetPosition(Vector position) { SetPosition(position, this.Width, this.Height); }