(41c5679ec) Resize fonts according to resolution (TODO: test on resolutions larger than 1080p)

This commit is contained in:
Joonas Rikkonen
2019-04-17 12:43:29 +03:00
parent 8c8f03ae25
commit cfd4df925a
2 changed files with 85 additions and 22 deletions
@@ -7,7 +7,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
public class ScalableFont
public class ScalableFont : IDisposable
{
private static List<ScalableFont> FontList = new List<ScalableFont>();
private static Library Lib = null;
@@ -30,7 +30,7 @@ namespace Barotrauma
set
{
size = value;
if (graphicsDevice!=null) RenderAtlas(graphicsDevice, charRanges, texDims, baseChar);
if (graphicsDevice != null) RenderAtlas(graphicsDevice, charRanges, texDims, baseChar);
}
}
@@ -302,5 +302,15 @@ namespace Barotrauma
}
return retVal;
}
public void Dispose()
{
FontList.Remove(this);
foreach (Texture2D texture in textures)
{
texture.Dispose();
}
textures.Clear();
}
}
}