Use Texture2D in TextureLoader cache
This commit is contained in:
parent
691220b5c8
commit
886b840d6c
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using KeepersCompound.LGS;
|
||||
|
@ -9,7 +8,7 @@ namespace KeepersCompound.TMV;
|
|||
public partial class TextureLoader
|
||||
{
|
||||
private readonly string _fmName;
|
||||
private readonly List<ImageTexture> _textureCache = new();
|
||||
private readonly List<Texture2D> _textureCache = new();
|
||||
private readonly Dictionary<int, int> _idMap = new();
|
||||
private readonly Dictionary<int, string> _idPathMap = new();
|
||||
private readonly Dictionary<string, int> _pathMap = new();
|
||||
|
@ -73,7 +72,7 @@ public partial class TextureLoader
|
|||
}
|
||||
|
||||
// TODO: We should report load failures
|
||||
public ImageTexture Get(int id)
|
||||
public Texture2D Get(int id)
|
||||
{
|
||||
if (_idMap.TryGetValue(id, out int value))
|
||||
{
|
||||
|
@ -89,7 +88,7 @@ public partial class TextureLoader
|
|||
}
|
||||
|
||||
// TODO: Load by path :)
|
||||
public ImageTexture Get(string path)
|
||||
public Texture2D Get(string path)
|
||||
{
|
||||
if (!_pathMap.ContainsKey(path))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue