From 9a47ee7b551e78dded162fbc94a62c65d0654096 Mon Sep 17 00:00:00 2001 From: lisk77 Date: Thu, 27 Nov 2025 12:50:37 +0100 Subject: [PATCH 1/2] refactor(components): texts now store a String to allow mutable text --- crates/comet_ecs/src/component.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/comet_ecs/src/component.rs b/crates/comet_ecs/src/component.rs index 177f31e..798be14 100755 --- a/crates/comet_ecs/src/component.rs +++ b/crates/comet_ecs/src/component.rs @@ -59,7 +59,7 @@ pub struct Camera2D { #[derive(Component)] pub struct Text { - content: &'static str, + content: String, font: &'static str, font_size: f32, color: Color, @@ -462,14 +462,14 @@ impl Camera for Camera2D { impl Text { pub fn new( - content: &'static str, + content: impl Into, font: &'static str, font_size: f32, is_visible: bool, color: impl ColorTrait, ) -> Self { Self { - content, + content: content.into(), font, font_size, color: Color::from_wgpu_color(color.to_wgpu()), @@ -478,12 +478,12 @@ impl Text { } } - pub fn content(&self) -> &'static str { - self.content + pub fn content(&self) -> &str { + &self.content } - pub fn set_content(&mut self, content: &'static str) { - self.content = content; + pub fn set_content(&mut self, content: impl Into) { + self.content = content.into(); } pub fn font(&self) -> &'static str { From 52a234a23e0703598eb76132f8c44d06d404d5c0 Mon Sep 17 00:00:00 2001 From: lisk77 Date: Thu, 27 Nov 2025 12:52:24 +0100 Subject: [PATCH 2/2] feat(app): added interface for the actual renderer delta time --- crates/comet_app/src/app.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/comet_app/src/app.rs b/crates/comet_app/src/app.rs index 977f8ec..1b27ff1 100755 --- a/crates/comet_app/src/app.rs +++ b/crates/comet_app/src/app.rs @@ -301,6 +301,11 @@ impl App { self.update_timer } + /// Returns the last frame time as computed by the renderer. + pub fn frame_dt(&self) -> f32 { + self.delta_time + } + /// Sets the amount of times the `App` game logic is updated per second pub fn set_update_rate(&mut self, update_rate: u32) { if update_rate == 0 {