1 #ifndef BZ_TYPES_RECT_H
2 #define BZ_TYPES_RECT_H
4 #include <bz/types/point.h>
5 #include <bz/types/size.h>
15 typedef struct BZRect BZRect;
17 static inline BZRect bzRectMake(float x, float y, float w, float h) {
18 return (BZRect){ .origin = bzPointMake(x, y), .size = bzSizeMake(w, h) };
21 static inline float bzRectMinX(BZRect rect) {
22 return rect.origin.x - rect.size.width / 2.0f;
25 static inline float bzRectMidX(BZRect rect) {
29 static inline float bzRectMaxX(BZRect rect) {
30 return rect.origin.x + rect.size.width / 2.0f;
33 static inline float bzRectMinY(BZRect rect) {
34 return rect.origin.y - rect.size.height / 2.0f;
37 static inline float bzRectMidY(BZRect rect) {
41 static inline float bzRectMaxY(BZRect rect) {
42 return rect.origin.y + rect.size.height / 2.0f;
45 //#define bzRectMake(x, y, w, h) ((BZRect){ .origin = {.x = (x), .y = (y)}, .size = {.width = (w), .height = (h)} })