aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriamcheeseman <[email protected]>2026-05-15 07:24:38 -0400
committeriamcheeseman <[email protected]>2026-05-15 07:24:38 -0400
commitb5561bbf7f2639a2bd9754358ddb6acded7355b1 (patch)
treeba59f5bd598d1a5bac50ec0d01b2101ae0019290
parent13176faf0daf862d3ceb88bec08120b2383a2592 (diff)
update test program to use tyui
-rw-r--r--dc/dc.c71
1 files changed, 8 insertions, 63 deletions
diff --git a/dc/dc.c b/dc/dc.c
index a532f0a..66fbf1c 100644
--- a/dc/dc.c
+++ b/dc/dc.c
@@ -65,69 +65,14 @@ void tick(void)
double frame_time = ty_get_time() - last_frame;
last_frame = ty_get_time();
- char ms_fmt[] = "%.2g ms";
- int ms_width = ty_font_width(&font, ms_fmt, frame_time * 1000);
-
- int y = 5;
- ty_draw_rect(
- (ty_Recti){
- 5, 5,
- ms_width, 8,
- },
- TY_COLOR_GRAY
- );
- ty_draw_text_fmt(
- &font,
- ty_vec2i(5, 5),
- ms_fmt,
- frame_time * 1000
- );
- y += 8;
-
- char fps_fmt[] = "%2d fps";
- int fps_width = ty_font_width(&font, fps_fmt, (int)(1.0 / frame_time));
-
- ty_draw_rect(
- (ty_Recti){
- 5, 5 + 8,
- fps_width, 8,
- },
- TY_COLOR_GRAY
- );
- ty_draw_text_fmt(
- &font,
- ty_vec2i(5, 5 + 8),
- fps_fmt,
- (int)(1.0 / frame_time)
- );
- y += 8;
-
- ty_draw_text_fmt(&font, ty_vec2i(5, y),
- "%.2g",
- ty_get_time()
- );
- y += 8;
-
- ty_draw_text(&font, ty_vec2i(5, y),
- "abcdefghijklmnopqrstuvwxyz"
- );
- y += 8;
- ty_draw_text(&font, ty_vec2i(5, y),
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- );
- y += 8;
- ty_draw_text(&font, ty_vec2i(5, y),
- "0123456789"
- );
- y += 8;
- ty_draw_text(&font, ty_vec2i(5, y),
- "!\"'#$%&()*+,-./@[]\\"
- );
- y += 8;
- ty_draw_text(&font, ty_vec2i(5, y),
- "^_`{}|~:;<>=? "
- );
- y += 8;
+ tyui_text("%.2g ms", frame_time * 1000);
+ tyui_text("%.2d fps", (int)(1.0 / frame_time));
+ tyui_text("%d", (int)ty_get_time());
+ tyui_text("abcdefghijklmnopqrstuvwxyz");
+ tyui_text("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ tyui_text("0123456789");
+ tyui_text("!\"'#$%&()*+,-./@[]\\");
+ tyui_text("^_`{}|~:;<>=? ");
if (tyui_begin_window("Test Window", ty_recti(5, 5, 100, 100), &winid)) {
for (int i = 0; i < 3; i++)