diff options
author | quou <quou@disroot.org> | 2024-06-01 12:19:16 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-06-01 12:20:17 +1000 |
commit | ea7cd94f7aeb177618db3907a6c86b7252e018f0 (patch) | |
tree | e972f9cf590ef756c2e41f3eac5b03e16db08300 /rect.h |
Initial commit.
Diffstat (limited to 'rect.h')
-rw-r--r-- | rect.h | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -0,0 +1,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 |