Skip to content

Commit d13fe9d

Browse files
committed
[update] events & component to be defined in the packge root. Update all references.
1 parent 8daf97a commit d13fe9d

File tree

10 files changed

+57
-70
lines changed

10 files changed

+57
-70
lines changed

crates/lambda-rs/examples/push_constants.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use lambda::{
2-
core::{
3-
component::Component,
4-
events::WindowEvent,
5-
runtime::start_runtime,
6-
},
2+
component::Component,
3+
core::runtime::start_runtime,
4+
events::WindowEvent,
75
math::{
86
matrix,
97
matrix::Matrix,
@@ -201,19 +199,17 @@ impl Component for PushConstantsExample {
201199
println!("Detaching component");
202200
}
203201

204-
fn on_event(&mut self, event: lambda::core::events::Events) {
202+
fn on_event(&mut self, event: lambda::events::Events) {
205203
// Only handle resizes.
206204
match event {
207-
lambda::core::events::Events::Window { event, issued_at } => {
208-
match event {
209-
WindowEvent::Resize { width, height } => {
210-
self.width = width;
211-
self.height = height;
212-
println!("Window resized to {}x{}", width, height);
213-
}
214-
_ => {}
205+
lambda::events::Events::Window { event, issued_at } => match event {
206+
WindowEvent::Resize { width, height } => {
207+
self.width = width;
208+
self.height = height;
209+
println!("Window resized to {}x{}", width, height);
215210
}
216-
}
211+
_ => {}
212+
},
217213
_ => {}
218214
}
219215
}

crates/lambda-rs/examples/triangle.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use lambda::{
2-
core::{
3-
component::Component,
4-
events::{
5-
ComponentEvent,
6-
Events,
7-
KeyEvent,
8-
WindowEvent,
9-
},
10-
runtime::start_runtime,
2+
component::Component,
3+
core::runtime::start_runtime,
4+
events::{
5+
ComponentEvent,
6+
Events,
7+
KeyEvent,
8+
WindowEvent,
119
},
1210
render::{
1311
command::RenderCommand,
@@ -59,7 +57,7 @@ impl Component for DemoComponent {
5957
fn on_event(self: &mut DemoComponent, event: Events) {
6058
match event {
6159
Events::Runtime { event, issued_at } => match event {
62-
lambda::core::events::RuntimeEvent::Shutdown => {
60+
lambda::events::RuntimeEvent::Shutdown => {
6361
println!("Shutting down the runtime");
6462
}
6563
_ => {}

crates/lambda-rs/examples/triangles.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use lambda::{
2-
core::{
3-
component::Component,
4-
events::{
5-
Events,
6-
KeyEvent,
7-
VirtualKey,
8-
WindowEvent,
9-
},
10-
runtime::start_runtime,
2+
component::Component,
3+
core::runtime::start_runtime,
4+
events::{
5+
Events,
6+
KeyEvent,
7+
VirtualKey,
8+
WindowEvent,
119
},
1210
render::{
1311
command::RenderCommand,
@@ -144,7 +142,7 @@ impl Component for TrianglesComponent {
144142
fn on_event(&mut self, event: Events) {
145143
match event {
146144
Events::Runtime { event, issued_at } => match event {
147-
lambda::core::events::RuntimeEvent::Shutdown => {
145+
lambda::events::RuntimeEvent::Shutdown => {
148146
println!("Shutting down the runtime");
149147
}
150148
_ => {}

crates/lambda-rs/src/core/component.rs renamed to crates/lambda-rs/src/component.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::time::Duration;
22

3-
use super::events::Events;
4-
use crate::render::{
5-
command::RenderCommand,
6-
RenderContext,
3+
use crate::{
4+
events::Events,
5+
render::{
6+
command::RenderCommand,
7+
RenderContext,
8+
},
79
};
810

911
/// The Component Interface for allowing Component based data structures

crates/lambda-rs/src/core/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
pub mod component;
2-
pub mod events;
31
pub mod runtime;
42
pub mod window;
File renamed without changes.

crates/lambda-rs/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
pub mod component;
12
pub mod components;
23
pub mod core;
4+
pub mod events;
35
pub mod math;
46
pub mod render;
57
pub mod runtimes;

crates/lambda-rs/src/render/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use lambda_platform::winit::{
55
WindowProperties,
66
};
77

8-
use crate::core::events::Events;
8+
use crate::events::Events;
99

1010
pub struct WindowBuilder {
1111
name: String,

crates/lambda-rs/src/runtimes/application.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use std::time::Instant;
66

77
use lambda_platform::winit::{
88
winit_exports::{
9-
ControlFlow,
109
ElementState,
1110
Event as WinitEvent,
1211
WindowEvent as WinitWindowEvent,
@@ -16,16 +15,14 @@ use lambda_platform::winit::{
1615
};
1716

1817
use crate::{
19-
core::{
20-
component::Component,
21-
events::{
22-
ComponentEvent,
23-
Events,
24-
KeyEvent,
25-
RuntimeEvent,
26-
WindowEvent,
27-
},
28-
runtime::Runtime,
18+
component::Component,
19+
core::runtime::Runtime,
20+
events::{
21+
ComponentEvent,
22+
Events,
23+
KeyEvent,
24+
RuntimeEvent,
25+
WindowEvent,
2926
},
3027
render::{
3128
window::{

tools/obj_loader/src/main.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ use args::{
88
ParsedArgument,
99
};
1010
use lambda::{
11-
core::{
12-
component::Component,
13-
events::{
14-
ComponentEvent,
15-
Events,
16-
WindowEvent,
17-
},
18-
runtime::start_runtime,
11+
component::Component,
12+
core::runtime::start_runtime,
13+
events::{
14+
ComponentEvent,
15+
Events,
16+
WindowEvent,
1917
},
2018
math::matrix::{
2119
self,
@@ -178,16 +176,14 @@ struct ObjLoader {
178176
impl Component for ObjLoader {
179177
fn on_event(&mut self, event: Events) {
180178
match event {
181-
lambda::core::events::Events::Window { event, issued_at } => {
182-
match event {
183-
WindowEvent::Resize { width, height } => {
184-
self.width = width;
185-
self.height = height;
186-
println!("Window resized to {}x{}", width, height);
187-
}
188-
_ => {}
179+
lambda::events::Events::Window { event, issued_at } => match event {
180+
WindowEvent::Resize { width, height } => {
181+
self.width = width;
182+
self.height = height;
183+
println!("Window resized to {}x{}", width, height);
189184
}
190-
}
185+
_ => {}
186+
},
191187
_ => {}
192188
}
193189
}

0 commit comments

Comments
 (0)