Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
rect.h
Go to the documentation of this file.
1
22#ifndef BJ_RECT_H
23#define BJ_RECT_H
24
25#include <banjo/api.h>
26
33struct bj_rect {
34 int16_t x;
35 int16_t y;
36 uint16_t w;
37 uint16_t h;
38};
39
65 const struct bj_rect* rect_a,
66 const struct bj_rect* rect_b,
67 struct bj_rect* result
68);
69
94 const struct bj_rect* rect_a,
95 const struct bj_rect* rect_b,
96 struct bj_rect* result
97);
98
99#endif
100
General-purpose definitions for Banjo API.
#define BANJO_EXPORT
Definition api.h:163
uint32_t bj_bool
Boolean type used throughout the Banjo API.
Definition api.h:257
uint16_t w
Width in pixels.
Definition rect.h:36
uint16_t h
Height in pixels.
Definition rect.h:37
int16_t y
Y coordinate of the top-left corner (pixels, can be negative).
Definition rect.h:35
int16_t x
X coordinate of the top-left corner (pixels, can be negative).
Definition rect.h:34
void bj_rect_union(const struct bj_rect *rect_a, const struct bj_rect *rect_b, struct bj_rect *result)
Compute the bounding box that contains both rectangles.
bj_bool bj_rect_intersection(const struct bj_rect *rect_a, const struct bj_rect *rect_b, struct bj_rect *result)
Compute the intersection of two rectangles.
Axis-aligned rectangle: a top-left corner plus a width and height.
Definition rect.h:33