/// <summary> /// Draws a string. /// </summary> /// <param name="text">The Text.</param> /// <param name="font">The Font.</param> /// <param name="position">The Position.</param> /// <param name="color">The Color.</param> public void DrawString(string text, IFont font, Vector2 position, Color color) { var oglFont = font as OpenGLFont; if (oglFont == null) { throw new ArgumentException("Expected a OpenGLFont as resource."); } OpenGLTexture texture = _textEntityManager.GetFontTexture(text, oglFont, color); DrawTexture(texture, position, Color.White); }
/// <summary> /// Draws a string. /// </summary> /// <param name="text">The Text.</param> /// <param name="font">The Font.</param> /// <param name="rectangle">The Rectangle.</param> /// <param name="color">The Color.</param> public void DrawString(string text, IFont font, Rectangle rectangle, Color color) { var oglFont = font as OpenGLFont; if (oglFont == null) { throw new ArgumentException("Expected a OpenGLFont as resource."); } OpenGLTexture texture = _textEntityManager.GetFontTexture(text, oglFont, color, (int)rectangle.Width); DrawTexture(texture, new Vector2(rectangle.X, rectangle.Y), Color.White); }
/// <summary> /// Draws the text. /// </summary> public void DrawText() { Texture = new OpenGLTexture(BitmapFont.DrawTextToBitmap(_text, _font, _color)); }