Dispose of old textures

If there were previously-stored fonts, dispose of them before creating
new fonts.
This commit is contained in:
yankejustin 2015-08-07 14:11:33 -04:00
parent cf5d54b9da
commit 1ba64128bb

View File

@ -73,6 +73,14 @@ namespace TrueCraft.Client.Rendering
using (var contents = File.OpenRead(Path.Combine(contentManager.RootDirectory, definitionPath)))
_definition = FontLoader.Load(contents);
if (_textures != null)
{
for (int i = 0; i < _textures.Length; i++)
{
_textures[i].Dispose();
}
}
// We need to support multiple texture pages for more than plain ASCII text.
_textures = new Texture2D[_definition.Pages.Count];
for (int i = 0; i < _definition.Pages.Count; i++)