Here is an example of how you might use it with your rendering engine:
// Create a new atlas with 4 bytes per pixel.
// (4 for RGBA, 3 for RGB, 2 for RGB565 etc.)
struct atlas* atlas = atlas_new(4);
// Adding a new entry to the atlas is straightforward.
// You can look in atlas.h to see memory ownership rules and more detailed
// documentation on every function.
struct atlas_entry* entry = atlas_add_entry(atlas,
data_width, data_height, raw_data,
unsigned int w, h;
// Here is where the work happens. The entries are arranged and the final
// texture data is returned. You can query for any entries that the packing was
// not able to fit with `atlas_get_pack_failed`. See demo.c for an example.
uint8_t* packed_image = atlas_pack(atlas,
MAX_TEXTURE_SIZE, MAX_TEXTURE_SIZE, &w, &h);
// MyAtlasedTexture would be your entry point for bridging the atlas output and
// your sprites. `packed_image` will be the same format as the entries you pass
// into the atlas.
MyAtlasedTexture texture = NewMyAtlasedTexture(packed_image, w, h);
unsigned int x, y;
// Getting the location of an entry you added earlier is also straightforward.
// How you hook up to your rendering engine beyond here is not within the scope
// of this library.
atlas_entry_get_packed_location(entry, &x, &y, &w, &h);
MyTextureSubRegion sub_region = NewMyTextureSubRegion(texture, x, y, w, h);
MySprite sprite = NewMySprite(sub_region);
A simple example using SDL2 can be found in demo.c.