Types and constants
#define AY2D_ABI_VERSION 1u
typedef struct ay2d_model ay2d_model; /* opaque */
typedef struct ay2d_canvas_info {
float width, height; /* pixels */
float pixels_per_unit;
float origin_x, origin_y; /* the pixel at model unit (0, 0) */
} ay2d_canvas_info;
typedef struct ay2d_drawable {
uint32_t mesh; /* index, < ay2d_mesh_count */
uint32_t texture; /* index, < ay2d_texture_count */
uint32_t flags; /* AY2D_FLAG_* */
float opacity; /* 0 to 1, times the texture's alpha */
uint32_t vertex_count;
uint32_t index_count; /* a multiple of 3 */
uint32_t mask_count;
const float *positions; /* vertex_count xy pairs, model units */
const float *uvs; /* vertex_count uv pairs, 0 to 1 */
const uint16_t *indices; /* triangle list */
const uint32_t *masks; /* meshes whose alpha clips this one */
} ay2d_drawable;
typedef struct ay2d_motion_facts {
float duration, fps; /* seconds; the authored frame rate */
int32_t looped; /* 1 when authored to loop */
int32_t composition; /* 1 for a composition, 0 for a scene */
float fade_in, fade_out; /* seconds, -1 when not authored */
uint32_t event_count;
} ay2d_motion_facts;
typedef struct ay2d_event {
uint32_t motion; /* the motion that fired it */
float time; /* on that motion's clock */
const char *name; /* lives as long as the model */
} ay2d_event;
| Constant | Value | Meaning |
|---|---|---|
AY2D_FLAG_ADDITIVE |
1 | add blend |
AY2D_FLAG_MULTIPLICATIVE |
2 | multiply blend |
AY2D_FLAG_DOUBLE_SIDED |
4 | draw both faces |
AY2D_FLAG_INVERTED_MASK |
8 | show only where the masks are not |
AY2D_CHANGED_POSITIONS |
1 | vertices moved |
AY2D_CHANGED_VISIBILITY |
2 | appeared or disappeared |
AY2D_CHANGED_OPACITY |
4 | opacity changed |
AY2D_CHANGED_ORDER |
8 | place in the draw order changed |
Neither blend flag set means normal blending.