use actuate::prelude::*;
use bevy::prelude::*;
#[derive(Data)]
struct Timer;
impl Compose for Timer {
fn compose(cx: Scope<Self>) -> impl Compose {
let current_time = use_mut(&cx, Time::default);
use_world(&cx, move |time: Res<Time>| {
SignalMut::set(current_time, *time)
});
spawn(Text::new(format!("Elapsed: {:?}", current_time.elapsed())))
}
}
fn main() {
App::new()
.add_plugins((DefaultPlugins, ActuatePlugin))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d::default());
commands.spawn((Node::default(), Composition::new(Timer)));
}