DrawText() public method

Draws the text.
public DrawText ( ) : void
return void
コード例 #1
0
        /// <summary>
        /// Gets the font texture.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="color">The Color.</param>
        /// <param name="wrapWidth">The WrapWidth.</param>
        /// <returns></returns>
        public OpenGLTexture GetFontTexture(string text, OpenGLFont font, Color color, int wrapWidth = 0)
        {
            var textEntity = new TextEntity(text, font, color, wrapWidth);
            if (_cache.ContainsKey(textEntity.Id))
            {
                return _cache[textEntity.Id].Texture;
            }

            if (_cache.Count > MaxEntityCache)
            {
                var entity = _cache.Values.First();
                _cache.Remove(entity.Id);
            }

            textEntity.DrawText();
            _cache.Add(textEntity.Id, textEntity);
            return textEntity.Texture;
        }
コード例 #2
0
        /// <summary>
        /// Gets the font texture.
        /// </summary>
        /// <param name="text">The Text.</param>
        /// <param name="font">The Font.</param>
        /// <param name="color">The Color.</param>
        /// <param name="wrapWidth">The WrapWidth.</param>
        /// <returns></returns>
        public OpenGLTexture GetFontTexture(string text, OpenGLFont font, Color color, int wrapWidth = 0)
        {
            var textEntity = new TextEntity(text, font, color, wrapWidth);

            if (_cache.ContainsKey(textEntity.Id))
            {
                return(_cache[textEntity.Id].Texture);
            }

            if (_cache.Count > MaxEntityCache)
            {
                var entity = _cache.Values.First();
                _cache.Remove(entity.Id);
            }

            textEntity.DrawText();
            _cache.Add(textEntity.Id, textEntity);
            return(textEntity.Texture);
        }