Skip to content

CF_Png

Category: png_cache
GitHub: cute_png_cache.h


A single image of raw pixels, loaded from a png cache.

Struct Members Description
const char* path Path to the associated png on-disk.
uint64_t id Unique identifier assigned by the cache.
CF_Pixel* pix Pointer to the pixels of the png image.
int w Width of the image in pixels.
int h Height of the image in pixels.

Remarks

The png cache is used to load png images from disk in order to make sprites. The png cache system is an advanced option for people who want lower level access to creating their own custom sprites, for example by loading sprites from their own custom animation format. If you just want a really easy way to load sprites, look at cute_sprite.h for the easy sprite API (search for easy_make_sprite or make_sprite functions).

You will mostly just care about these three functions.

cf_png_cache_load
cf_png_cache_unload
cf_make_png_cache_sprite

It's a cache, which means it actually caches images loaded in RAM, so subsequent calls to cf_png_cache_load won't have to fetch the image off of disk, as long as the image is currently cached in RAM.

cf_make_png_cache_sprite
cf_png_defaults
cf_png_cache_load
cf_make_png_cache_animation