aboutsummaryrefslogtreecommitdiff
path: root/particle.c
blob: c10e3aaafab74f7b18513c5c6aa427038f0fbca0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "animation.h"
#include "asset.h"
#include "obj.h"
#include "render.h"

void init_particle(Particle* p, int x, int y, int anim, int bmp) {
	p->x = x;
	p->y = y;
	p->frame = 0;
	p->anim = anim;
	p->bmp = bmp;
}

int update_particle(Particle* p) {
	const Animation* a = get_animation(p->anim);
	return update_anim(a, &p->frame, &p->rect);
}

void ren_particle(const Particle* p, Renderer* r) {
	const Bitmap* b = get_bitmap(p->bmp);
	ren_map(
		r,
		p->x,
		p->y,
		&p->rect,
		b
	);
}