No mipmaps on subtitles

This commit is contained in:
Nick 2022-06-19 18:19:24 -04:00
parent df9fc8121f
commit 56def6cd68
2 changed files with 125 additions and 120 deletions

View File

@ -75,7 +75,7 @@ namespace NewHorizons.Handlers
{ {
Logger.Log($"Adding subtitle for {mod.ModHelper.Manifest.Name}"); Logger.Log($"Adding subtitle for {mod.ModHelper.Manifest.Name}");
var tex = ImageUtilities.GetTexture(mod, filepath); var tex = ImageUtilities.GetTexture(mod, filepath, false);
if (tex == null) return; if (tex == null) return;
var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, SUBTITLE_HEIGHT), new Vector2(0.5f, 0.5f), 100.0f); var sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, SUBTITLE_HEIGHT), new Vector2(0.5f, 0.5f), 100.0f);

View File

@ -15,6 +15,11 @@ namespace NewHorizons.Utility
private static List<Texture2D> _generatedTextures = new List<Texture2D>(); private static List<Texture2D> _generatedTextures = new List<Texture2D>();
public static Texture2D GetTexture(IModBehaviour mod, string filename) public static Texture2D GetTexture(IModBehaviour mod, string filename)
{
return GetTexture(mod, filename, true);
}
public static Texture2D GetTexture(IModBehaviour mod, string filename, bool useMipmaps)
{ {
// Copied from OWML but without the print statement lol // Copied from OWML but without the print statement lol
var path = mod.ModHelper.Manifest.ModFolderPath + filename; var path = mod.ModHelper.Manifest.ModFolderPath + filename;
@ -28,7 +33,7 @@ namespace NewHorizons.Utility
try try
{ {
var data = File.ReadAllBytes(path); var data = File.ReadAllBytes(path);
var texture = new Texture2D(2, 2); var texture = new Texture2D(2, 2, TextureFormat.RGBA32, useMipmaps);
texture.name = Path.GetFileNameWithoutExtension(path); texture.name = Path.GetFileNameWithoutExtension(path);
texture.LoadImage(data); texture.LoadImage(data);
_loadedTextures.Add(path, texture); _loadedTextures.Add(path, texture);