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); }
protected virtual void RenderText(string text) { TextTextureRenderer.RenderText(text, font, texture); }