ref: 4ae4cb2ec7d3fecf526b29d98eeb55d374a99dda
dir: /sprite.c/
#include <u.h> #include <libc.h> #include <draw.h> #include <stdio.h> #include "dormer.h" Sprite* mksprite(Canvas *c, char *path, int tnum) { c->spritev[c->si].image = readimage(display, open(path, OREAD), 0); c->spritev[c->si].tnum = tnum; Sprite *s = &c->spritev[c->si++]; return s; } void mvsprite(Sprite *s, int x, int y, int tile) { Image *im = s->image; s->tile = tile; s->x = x - (s->tile-1)*(im->r.max.x / s->tnum); s->y = y; }