Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.23 KB

raster_cache.md

File metadata and controls

26 lines (18 loc) · 1.23 KB

RasterCache class

Handles Raster image caching.

You can cache your raster images for faster access in a RasterCache with the load() or loadAll() methods. Pogo provides a static RasterCache for general use in the Assets static class.

await Assets.rasterCache.loadAll(['player.png', 'enemy.png']);

Or, you can instantiate your own copy of a RasterCache if needed. But, given that you can clear and reload the static cache, the use case of needing your own cache may not be common.

Methods

clear Clears all data from the cache.
get Returns an image, by filename, from the cache.
load Loads a single file into the cache. Returns a Raster Future.
loadAll Loads a List of files into the cache. Returns a List Future.
remove Removes a single image, by filename, from the cache.
setSubPath Override the default subdirectory for image files. Must specify a path underneath assets/ (or set to empty for assets/ root). Default: images/.

For an overview of how to setup your assets, see the getting started guide.