Skip to content

Commit 33344cc

Browse files
committed
[update] demo component output.
1 parent 8034f07 commit 33344cc

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

lambda/src/core/events.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use std::time::Instant;
55
pub enum ComponentEvent {
66
Attached { name: String },
77
Detached { name: String },
8+
Update { delta: Instant },
89
}
910

1011
/// Window events are generated in response to window events coming from
@@ -22,8 +23,8 @@ pub enum KernelEvent {
2223
Shutdown,
2324
}
2425

25-
/// Generic Event Enum which encapsulates all possible events that will be emitted
26-
/// by the LambdaKernel
26+
/// Generic Event Enum which encapsulates all possible events that will be
27+
/// emitted by the LambdaKernel
2728
#[derive(Debug)]
2829
pub enum Events {
2930
Component {

lambda/src/kernels/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ impl LambdaKernelBuilder {
6666
self.render_api = configure(self.render_api);
6767
return self;
6868
}
69-
/// Jjk
7069
/// Attach a component to the current runnable.
7170
pub fn with_component<T: Default + RenderableComponent<Events> + 'static>(
7271
self,
@@ -90,7 +89,7 @@ impl LambdaKernelBuilder {
9089
.with_name(name.as_str())
9190
.with_dimensions(width, height)
9291
.build(&mut event_loop);
93-
let component_stack = Vec::new();
92+
let component_stack = self.components;
9493
let render_api = self.render_api.build(&window);
9594

9695
return LambdaKernel {

tools/lambda_rs_demo/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ impl Component<Events> for DemoComponent {
4949

5050
fn on_update(self: &mut DemoComponent, last_frame: &std::time::Duration) {
5151
println!(
52-
"This layer was last updated: {} nanoseconds ago",
53-
last_frame.as_nanos()
54-
);
55-
56-
println!(
57-
"This layer was last updated: {} milliseconds ago",
52+
"This component was last updated: {} nanoseconds/{} milliseconds ago",
53+
last_frame.as_nanos(),
5854
last_frame.as_millis()
5955
);
6056
}
@@ -104,12 +100,16 @@ impl RenderableComponent<Events> for DemoComponent {
104100
.render_pipeline
105101
.as_ref()
106102
.expect(
107-
"No render pipeline set while trying to issue a render command",
103+
"No render pipeline set while trying to issue a render command.",
108104
)
109105
.clone(),
110106
},
111107
RenderCommand::BeginRenderPass {
112-
render_pass: self.render_pass.as_ref().unwrap().clone(),
108+
render_pass: self
109+
.render_pass
110+
.as_ref()
111+
.expect("Cannot begin the render pass when it doesn't exist.")
112+
.clone(),
113113
viewport: viewport.clone(),
114114
},
115115
RenderCommand::Draw { vertices: 0..3 },

0 commit comments

Comments
 (0)