28#ifndef __N_ATLAS_HEADER
29#define __N_ATLAS_HEADER
37#include "allegro5/allegro.h"
64int n_atlas_set_page(
N_ATLAS* atlas,
size_t page,
const void* bytes,
size_t len,
const char* ext, uint16_t cols, uint16_t rows);
uint16_t cols
grid width in cells
N_ATLAS_PAGE * pages
page array, npages entries
ALLEGRO_BITMAP * bmp
the decoded page bitmap, NULL until set
uint16_t rows
grid height in cells
size_t npages
number of pages
int n_atlas_max_bitmap_size(void)
get the largest bitmap dimension this display can hold
int n_atlas_set_page(N_ATLAS *atlas, size_t page, const void *bytes, size_t len, const char *ext, uint16_t cols, uint16_t rows)
decode bytes into one atlas page
int n_atlas_draw_cell(N_ATLAS *atlas, size_t page, size_t index, float x, float y, float size)
draw one cell as a size x size square
void n_atlas_destroy(N_ATLAS **atlas)
destroy an atlas and every bitmap it owns
int n_atlas_page_ready(const N_ATLAS *atlas, size_t page)
test whether a page holds a usable bitmap
int n_atlas_cell_rect(const N_ATLAS *atlas, size_t page, size_t index, float *sx, float *sy, float *sw, float *sh)
compute the source rectangle of one cell
N_ATLAS * new_n_atlas(size_t npages)
allocate an atlas holding npages empty pages
a set of atlas pages addressed as (page, cell index)
one atlas page: a bitmap holding cols*rows equally sized cells
Common headers and low-level functions & define.