Esempio n. 1
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);
        }
Esempio n. 2
0
 /// <summary>
 /// Draws a rectangle to screen.
 /// </summary>
 /// <param name="X">The starting X</param>
 /// <param name="Y">The starting Y</param>
 /// <param name="width">The width</param>
 /// <param name="height">The height</param>
 /// <param name="c">The color to use</param>
 public void DrawRectangle(float X, float Y, float width, float height, GLFont font, Color c)
 {
     VBO.AddQuad(new Vector2(X, Y), new Vector2(X + width, Y + height),
                 new Vector2(2f / Engine.GLFonts.bwidth, 2f / Engine.GLFonts.bheight), new Vector2(4f / Engine.GLFonts.bwidth, 4f / Engine.GLFonts.bheight),
                 new Vector4((float)c.R / 255f, (float)c.G / 255f, (float)c.B / 255f, (float)c.A / 255f), font.TexZ);
 }