//public static bool Contains(ushort g, int x, int y, int extra = 0) //{ // return _picker.Get(g, x, y, extra); //} public static ArtTexture GetStaticTexture(ushort g) { if (!_artDictionary.TryGetValue(g, out ArtTexture texture) || texture.IsDisposed) { ushort[] pixels = ReadStaticArt(g, out short w, out short h, out Rectangle imageRectangle); texture = new ArtTexture(imageRectangle, w, h); //texture.SetData(pixels); texture.SetDataHitMap16(pixels); _usedIndex.Add(g); //_picker.Set(g, w, h, pixels); _artDictionary.Add(g, texture); } //ref SpriteTexture texture = ref _artCache[g]; //if (texture == null || texture.IsDisposed) //{ // ushort[] pixels = ReadStaticArt(g, out short w, out short h); // texture = new SpriteTexture(w, h, false); // texture.SetData(pixels); // _usedIndex.Add(g); // _picker.Set(g, w, h, pixels); //} return(texture); }
public static ArtTexture GetStaticTexture(ushort g) { if (!_artDictionary.TryGetValue(g, out ArtTexture texture) || texture.IsDisposed) { ushort[] pixels = ReadStaticArt(g, out short w, out short h, out Rectangle imageRectangle); texture = new ArtTexture(imageRectangle, w, h); texture.SetDataHitMap16(pixels); _usedIndex.Add(g); _artDictionary.Add(g, texture); } return(texture); }