From 284fcdcb6da89d34ea67a51d016c7e4491548372 Mon Sep 17 00:00:00 2001 From: Franz Dietrich Date: Sun, 19 Oct 2025 08:49:20 +0200 Subject: [PATCH] clock example improvements --- turtle-lib/examples/clock.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/turtle-lib/examples/clock.rs b/turtle-lib/examples/clock.rs index 9ca3198..44c27a9 100644 --- a/turtle-lib/examples/clock.rs +++ b/turtle-lib/examples/clock.rs @@ -41,7 +41,13 @@ async fn main() { .pen_down() .forward(10.0) .right(90.0) - .write_text(format!("{i}"), 2 * pen_size as i32 + 10) + .pen_up() + .backward(pen_size.max(4.0) + (i / 10) as f32 * 4.0) //Approximate width of text + .pen_down() + .write_text(format!("{i}"), 2 * pen_size as i32 + 14) + .pen_up() + .forward(pen_size.max(4.0) + (i / 10) as f32 * 4.0) + .pen_down() .left(90.0); } @@ -51,7 +57,7 @@ async fn main() { .go_to(vec2(0.0, 0.0)) .set_heading(90.0) .right(FULL_CIRCLE / HOURS as f32 * (now.hour() % 12) as f32) - .set_pen_width(5.0) + .set_pen_width(7.0) .pen_down() .forward(120.0);