textureGetCached
Gets a texture from the internal texture cache. If a texture isn't used for one frame it gets removed from the cache and destroyed.
If you want to lazily create a texture, you could do:
const texture = dvui.textureGetCached(key) orelse blk: {
const texture = ...; // Create your texture here
dvui.textureAddToCache(key, texture);
break :blk texture;
}
Only valid between Window.beginand Window.end.
Parameters
- key:Texture.Cache.Key
- Texture.Cache.Key
Source
Implementation
pub fn textureGetCached(key: Texture.Cache.Key) ?Texture {
return currentWindow().texture_cache.get(key);
}