Ejemplo n.º 1
0
        /// <summary>
        /// Draws a string at a specified location.
        /// </summary>
        /// <param name="str">The string to draw.</param>
        /// <param name="X">The X location to draw it at</param>
        /// <param name="Y">The Y location to draw it at</param>
        /// <returns>The length of the string in pixels</returns>
        public float DrawString(string str, float X, float Y, Vector4 color, TextVBO vbo, bool flip = false)
        {
            float nX = 0;

            for (int i = 0; i < str.Length; i++)
            {
                if (str[i] == '\n')
                {
                    Y += Height;
                    nX = 0;
                }
                nX += DrawSingleCharacter(str[i], X + nX, Y, flip, vbo, color);
            }
            return(nX);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws a single symbol at a specified location.
        /// </summary>
        /// <param name="symbol">The symbol to draw.</param>
        /// <param name="X">The X location to draw it at</param>
        /// <param name="Y">The Y location to draw it at</param>
        /// <returns>The length of the character in pixels</returns>
        public float DrawSingleCharacter(char symbol, float X, float Y, bool flip, TextVBO vbo, Vector4 color)
        {
            RectangleF rec = RectForSymbol(symbol);

            if (flip)
            {
                vbo.AddQuad(new Vector2(X, Y),
                            new Vector2(X + rec.Width, Y + rec.Height),
                            new Vector2(rec.X / Engine.bwidth, (rec.Y + rec.Height) / Engine.bheight),
                            new Vector2((rec.X + rec.Width) / Engine.bwidth, rec.Y / Engine.bheight), color, TexZ);
            }
            else
            {
                vbo.AddQuad(new Vector2(X, Y),
                            new Vector2(X + rec.Width, Y + rec.Height),
                            new Vector2(rec.X / Engine.bwidth, rec.Y / Engine.bwidth),
                            new Vector2((rec.X + rec.Width) / Engine.bheight, (rec.Y + rec.Height) / Engine.bheight), color, TexZ);
            }
            return(rec.Width);
        }
Ejemplo n.º 3
0
 public FontSet(string _name, FontSetEngine engine)
 {
     Name   = _name.ToLower();
     Engine = engine;
     VBO    = new TextVBO(Engine.GLFonts);
 }