summaryrefslogtreecommitdiff
path: root/rect.h
blob: 4d6a88f6876dc27dfe35b449bcfad8fc704d3b92 (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
#ifndef rect_h
#define rect_h

typedef struct {
	int x, y, w, h;
} Rectangle;

Rectangle make_rect(int x, int y, int w, int h);

int rects_overlap(const Rectangle* a, const Rectangle* b);
int rects_overlap2(
	int x0,
	int y0,
	int w0,
	int h0,
	int x1,
	int y1,
	int w1,
	int h1
);
int point_rect_overlap(
	const Rectangle* r,
	int px,
	int py
);
int point_rect_overlap2(
	int x,
	int y,
	int w,
	int h,
	int px,
	int py
);
Rectangle rect_intersect(
	const Rectangle* a,
	const Rectangle* b
);
Rectangle* rect_merge(
	Rectangle* d,
	const Rectangle* r
);

#endif