public Texture2D PrepareResource(string text, System.Drawing.Font font)
        {
            int identifier = HashCode.Combine(text, font);

            if (!currentResources.TryGetValue(identifier, out Texture2D texture))
            {
                if (!previousResources.TryGetValue(identifier, out texture))
                {
                    texture = TextTextureRenderer.Resize(text, font, Game.GraphicsDevice, measureGraphics);
                    TextTextureRenderer.RenderText(text, font, texture);
                    currentResources.Add(identifier, texture);
                }
                else
                {
                    currentResources.Add(identifier, texture);
                    previousResources.Remove(identifier);
                }
            }
            return(texture);
        }
Ejemplo n.º 2
0
 protected virtual void RenderText(string text)
 {
     TextTextureRenderer.RenderText(text, font, texture);
 }
Ejemplo n.º 3
0
 protected virtual void Resize(string text)
 {
     TextTextureRenderer.Resize(text, font, ref texture, Game.GraphicsDevice);
 }