summaryrefslogtreecommitdiff
path: root/include/physics.h
blob: 8ffa438c8c1ec43e91d88665b7eb5d9120ec5f1d (plain)
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
#define PHX_TICK_TIME (1.0 / 480.0)

typedef int BodyID;

typedef enum {
	BTYPE_AABB,
	BTYPE_TILEMAP,
} BodyType;

typedef struct Body Body;
typedef struct CollisionEvent {
	BodyID body1;
	BodyID body2;
} CollisionEvent;

BodyID phxnew(BodyType type);
void   phxdel(BodyID);

void phxsetmap(int w, int h, int *tiles);

void phxsetpos(BodyID, float x, float y);
void phxsetsize(BodyID, float w, float h);
void phxapplyaccel(BodyID, float f[2]);

void phxgetpos(BodyID, float pos[2]);
void phxgetsize(BodyID, float size[2]);

int phxnextcollevent(CollisionEvent *ev);
void phxtick(float delta);

void phxfixtick(void);