From cd15c9789c9eeb9ec2fa367c39872685597e0c17 Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Mon, 11 May 2026 08:42:59 -0400 Subject: text rendering --- teensy/teensy.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'teensy/teensy.h') diff --git a/teensy/teensy.h b/teensy/teensy.h index 1f082f9..0b7829c 100644 --- a/teensy/teensy.h +++ b/teensy/teensy.h @@ -1,6 +1,8 @@ #ifndef TEENSY_H_ #define TEENSY_H_ +#include + #include "teensy_common.h" #include "teensy_context.h" #include "teensy_list.h" @@ -68,6 +70,10 @@ struct ty_image { int height; }; +struct ty_font { + struct ty_image glyphs[CHAR_MAX]; +}; + struct ty_renderer { struct ty_image screen; }; @@ -92,6 +98,9 @@ void ty_img_set_pixel( struct ty_color color ); +void ty_font_add_glyph(struct ty_font *font, uint8_t c, struct ty_image img); +int ty_font_width(struct ty_font *font, const char *fmt, ...); + void ty_draw_clear(struct ty_color col); void ty_draw_image(struct ty_image img, struct ty_vec2i pos); void ty_draw_image_ex( @@ -105,6 +114,13 @@ void ty_draw_line( struct ty_vec2i end, struct ty_color color ); +void ty_draw_text(struct ty_font *font, struct ty_vec2i pos, const char *text); +void ty_draw_text_fmt( + struct ty_font *font, + struct ty_vec2i pos, + const char *fmt, + ... +); void ty_draw_end(void); void ty_sleep(uint64_t ms); -- cgit v1.3-2-g0d8e