End-to-end Aseprite sprite pipeline: art + timeline → animated metasprite. More...
#include <snes.h>#include <snes/anim.h>#include "res/hero_meta.inc"#include "res/hero_anim.h"#include "res/hero.inc"Macros | |
| #define | HERO_X 112 |
| On-screen X of the metasprite origin (32-wide sprite, centred). | |
| #define | HERO_Y 88 |
| On-screen Y of the metasprite origin (48-tall sprite, centred). | |
| #define | VRAM_FONT 0x4000 |
| BG1 font tiles (4bpp, high VRAM so they clear the OBJ region). | |
| #define | VRAM_HERO 0x0000 |
| 4bpp hero tiles (res/hero.pic, incbin'd in data.asm) | |
| #define | VRAM_TEXT 0x6800 |
| BG1 text tilemap. | |
Functions | |
| static void | drawLabel (u16 idx) |
| Print the label for the currently playing generated clip. | |
| int | main (void) |
| Entry point: animate the generated metasprite, toggle clips on A. | |
Variables | |
| static AnimPlayer | hero_player = ANIM_PLAYER_INIT |
| Animation player driving the hero metasprite. | |
| static const MetaspriteStyle | hero_style = { .baseTile = 0, .size = OBJ_SMALL } |
| Metasprite pointer table generated by gfx4snes -P. | |
End-to-end Aseprite sprite pipeline: art + timeline → animated metasprite.
This example animates a 32×48 hero metasprite whose every byte of data is machine-generated from a single Aseprite project — no hand-authored frame tables, no hand-typed animation clips. It is the working reference for the two-tool sprite pipeline:
hero.aseprite ─┬─ gfx4snes -P → hero.pic/.pal + res/hero_meta.inc │ (tiles, palette, metasprite pointer table) └─ aseprite2snes → res/hero_anim.h (one AnimClip per Aseprite tag)
gfx4snes owns the pixels and the metasprite geometry; aseprite2snes owns the timeline (tags, per-frame durations, direction) that indexes it. They meet at the frame value: a clip's frame i selects hero_metasprites[i], resolved inline by animTickMeta().
The artist authored two tags in Aseprite — walk (forward loop) and wave (ping-pong) — with per-frame millisecond durations. aseprite2snes converted those to ticks and folded the ping-pong into the frame order; press A to toggle between the two generated clips.
| #define HERO_X 112 |
On-screen X of the metasprite origin (32-wide sprite, centred).
| #define HERO_Y 88 |
On-screen Y of the metasprite origin (48-tall sprite, centred).
| #define VRAM_FONT 0x4000 |
BG1 font tiles (4bpp, high VRAM so they clear the OBJ region).
| #define VRAM_HERO 0x0000 |
4bpp hero tiles (res/hero.pic, incbin'd in data.asm)
Hero sprite palette, 16 colours (res/hero.pal)
OBJ VRAM word address for the hero tiles (OBJSEL name base = 0)
| #define VRAM_TEXT 0x6800 |
BG1 text tilemap.
|
static |
Print the label for the currently playing generated clip.
| idx | One of HERO_ANIM_WALK / HERO_ANIM_WAVE. |
| int main | ( | void | ) |
Entry point: animate the generated metasprite, toggle clips on A.
|
static |
Animation player driving the hero metasprite.
|
static |
Metasprite pointer table generated by gfx4snes -P.
Defines hero_metasprite0..3 (each a MetaspriteItem[] terminated by METASPR_TERM) plus hero_metasprites[4], the pointer table the animation clips index. One entry per cell of the hero.png sheet, in sheet order.
Animation clips generated by aseprite2snes from res/hero.json.
Defines hero_walk / hero_wave (AnimClip), the hero_anims[] pointer table and the HERO_ANIM_* index enum. Frame values index hero_metasprites[] above.
The hero's sheet starts at tile 0 and its pieces are the small OBJ size; the frame comes from the animation at each call.