// --------------------------------------------------------------------------------------------- // Copyright (c) 2021-2024, Jiaqi (0x7c13) Liu. All rights reserved. // See LICENSE file in the project root for license information. // --------------------------------------------------------------------------------------------- namespace Engine.Services { using Core.Abstraction; /// /// Interface for a texture cache that stores and retrieves textures by a string key. /// public interface ITextureCache { /// /// Adds a texture to the cache with the specified key. /// /// The key to associate with the texture. /// The texture to add to the cache. /// Whether the texture has an alpha channel. public void Add(string key, ITexture2D texture, bool hasAlphaChannel); /// /// Attempts to retrieve a texture from the cache with the specified key. /// /// The key associated with the texture. /// The retrieved texture, if found. /// True if the texture was found in the cache, false otherwise. public bool TryGet(string key, out (ITexture2D texture, bool hasAlphaChannel) texture); /// /// Disposes all textures in the cache. /// public void DisposeAll(); } }