aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy.h
diff options
context:
space:
mode:
Diffstat (limited to 'teensy/teensy.h')
-rw-r--r--teensy/teensy.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/teensy/teensy.h b/teensy/teensy.h
index 346d9eb..1a738d7 100644
--- a/teensy/teensy.h
+++ b/teensy/teensy.h
@@ -20,6 +20,9 @@
#define ty_rect_size(rect) (ty_vec2(rect.w, rect.h))
#define ty_recti_size(rect) (ty_vec2i(rect.w, rect.h))
+#define ty_max(a, b) ((a) > (b) ? (a) : (b))
+#define ty_min(a, b) ((a) < (b) ? (a) : (b))
+
#define TY_COLOR_BLACK ty_color(0, 0, 0 )
#define TY_COLOR_RED ty_color(255, 0, 0 )
#define TY_COLOR_GREEN ty_color(0, 255, 0 )
@@ -146,6 +149,11 @@ bool ty_pointi_in_recti(ty_Vec2i point, ty_Recti rect);
// Checks if a point is within a floating-point rect.
bool ty_point_in_rect(ty_Vec2 point, ty_Rect rect);
+// Shrinks a rect by `p`.
+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);
+
// Creates an image using the relevant data (formatted in RGB8). You may free
// the passed data after this call as it is copied.
ty_Image ty_create_image(int w, int h, const ty_Color* data);
@@ -165,6 +173,8 @@ void ty_img_set_pixel(
void ty_font_add_glyph(ty_Font *font, uint8_t c, ty_Image img);
// Calculates the length, in pixels, of the string when drawn with a font.
int ty_font_width(const ty_Font *font, const char *fmt, ...);
+// Calculates the font height
+int ty_font_height(const ty_Font *font);
// Sets the image that the renderer draws to. Pass NULL to restore the screen.
void ty_draw_set_target(const ty_Image *img);