aboutsummaryrefslogtreecommitdiff
path: root/obj.h
blob: 7f93ecca3eb57009bea7ea3d90fd4dddc5419773 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef obj_h
#define obj_h

#include "rect.h"

struct App;
struct Map;
struct Renderer;
struct World;

typedef enum {
	face_left,
	face_right
} Face;

typedef struct {
	int x, y, vx, vy;
	int frame;
	int anim;
	int grounded, headbutted, on_ramp, jumping;
	int cooldown;
	Face face;
	Rect rect;
} Player;

void init_player(Player* p);
void update_player(
	Player* p,
	struct World* w,
	const struct App* app,
	const struct Map* map
);
void ren_player(const Player* p, struct Renderer* r);

typedef struct {
	int x, y;
	int frame, anim;
	int bmp;
	Rect rect;
} Particle;

void init_particle(Particle* p, int x, int y, int anim, int bmp);
int update_particle(Particle* p);
void ren_particle(const Particle* p, struct Renderer* r);

#endif