diff options
Diffstat (limited to 'teensy/teensy.h')
| -rw-r--r-- | teensy/teensy.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/teensy/teensy.h b/teensy/teensy.h index e5954fc..80f9a71 100644 --- a/teensy/teensy.h +++ b/teensy/teensy.h @@ -22,6 +22,7 @@ #define ty_max(a, b) ((a) > (b) ? (a) : (b)) #define ty_min(a, b) ((a) < (b) ? (a) : (b)) +#define ty_clamp(a, mi, ma) (ty_max(ty_min(a, ma), mi)) #define TY_CLIP_NONE (ty_recti(0, 0, -1, -1)) @@ -155,6 +156,8 @@ bool ty_point_in_rect(ty_Vec2 point, ty_Rect rect); ty_Recti ty_recti_shrink(ty_Recti rect, int p); // Grows a rect by `p`. ty_Recti ty_recti_grow(ty_Recti rect, int p); +// Clamps a rect's bounds to be entirely within another. +ty_Recti ty_recti_clamp(ty_Recti rect, ty_Recti minmax); // Creates an image using the relevant data (formatted in RGB8). You may free // the passed data after this call as it is copied. |
