diff --git a/notes/MakingAnActualThing.txt b/notes/MakingAnActualThing.txt index 79a24c7f..9b498837 100644 --- a/notes/MakingAnActualThing.txt +++ b/notes/MakingAnActualThing.txt @@ -31,3 +31,23 @@ So for a sprite, which is a generic texture and position/size combo Images are similar, but instead of a "sprite" I made a computsprite because that's the only thing that uses them. Now if I had to shove these into a component / a set of components... I could have a component of the vertex type even? + + + +===== Sep 2020 ===== + +Lets think about this for a minute... + +* We have components which are purely data... + * But can also have structs that impl functionality + * The data can be contained within traits. But it has to do all IO through the trait interface. ALL + * Problem, for example I have primitives like textured sprites, and also complex widgets which also have additional IO they they need. Like text input or buttons. I suppose This could all be made message based. So when the text input receives a focus, and then key presses it would update. When the enter key is pressed it could create a customer event for which another component is the listener... + * Maybe this is the way to go... Have some generic structure that has a render(params), notify(event), update(delta) -> VEvent + * So if I had a textbox sprite it could notify(key events) render +* We can split up components in order to have sharable sets of data for shared functionality. e.g rendering + +[[paste]] + + + +So that article more or less talked about what I was thinking with the ECS. But they didn't really go into the separation of components. diff --git a/notes/paste.txt b/notes/paste.txt new file mode 100644 index 00000000..53cf0d1f --- /dev/null +++ b/notes/paste.txt @@ -0,0 +1,40 @@ +Content-Type: text/x-zim-wiki +Wiki-Format: zim 0.4 +Creation-Date: 2020-09-09T22:41:18-07:00 + +====== paste ====== +Created Wednesday 09 September 2020 + +// If I were to have multiple systems +/* + +One for rendering +One for updating +One for eventing + +Rendering is easy enough. It needs all the components necessary in order +to generate the vertices. This includes the position, size, and vertex generator + +Updating can probably be multiple types, I imagine something that implemented an Updatable +trait could then be used. + +So the big problem here is that I have two traits that I want to expose, BUT +I have to put the concrete value in both containers... I don't think this is something +that specs will like since it wants to be the only owner. No use in RefCell'ing it +because that's just stupid + +What if I turn this on it's head and really embrace the systems. So for example I could have +the User system. Ooof this is a big question actually... + +// Components that want to be updated +Move + +// want to be drawn +Drawable +Geom + +Notifyable + + + +*/ diff --git a/notes/vkprocessor.drawio b/notes/vkprocessor.drawio index 31bf96a4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HLkzXVAb63dJHDE5C4KSjS+5EXOazOeY9lTf3fHGxwQWkDK4qlhMbeYRkDhlNuEo+qgubCL80DNFflla+yQ3pV+xrCRkQjuUVS5fI8YYA7xAbmRJS0OW+KLqEMp94JAB4XErv6liWOs+EhALBv5CxRBALxIzU8YUrxP6k069N0XurjNyvxMqbTpJ3Ar7fyqS0+1YdK6dtevm8w2wZkZg6cJeecD0GqAd3LmhliimcO32DQgwYWtSp32RoMfWFIL6Twqcso+5T5nDLV7I3FbO23KV4jRYeJHNxzCnIknYU9AlFaxIwkAtSliF+RN5i5AVcxlJfOxlTCxQFqpouM1U1Gpiq2qei6s2lMPXIjDP3JJx9bL61spYps2LB8YjOMzAVAUa4u97k7lqngUmRkOrQ3dWKs5euf1hgUrsNTNa+cUntJi4ZW7mOftNtXLIkAv76fKHEgVFE6GWw0OqdhdoFsrCWHF4PzW5pOOwtPWxl6KHElhdIIxQxjsqEAXamBdU2Y4Zq74xRJaQujDEdE8bujTCbqbeUgqSiEKbxKNoR1qzmcuthT31LVNz/0zfVlvpW7X14I9vhUWOrLZ0Wm+SWHxTO52UcFGbDl5eOE1yjz4OiXs8pl3BQ5Inr1yeFflahNX/vClt+QrFbTXkCgYvhmZaFhraVw9t7skY/GWt0CczzhM6069BpQxm6pu9HxskSE/k7nYScx6ELWyJS3IqAab6sshupm+aI2uOnNlUuHs/vm2Zh0K99skck5cKiE74eAE5xa1g/6vqmq3zQTUKK2hZiM4TxiGBCN3N1F0B75nB5xCj5hJURy7HhdHYSwAXCqrUnz7WTYWw0OKeF+WPvprzhpY1XChDLpfwpxUChSXOJS8HyKiQRYogEA22UmomTGwVe1qGEF9LFEBU5wIe/yQC+yesFhKFZcgXT1LphOA5dXpdfuRAz8JHeeX5r5xpAHEIYzljn9y3D7UJeMSXn0OwG59i+7Tqec/R6M3qBhXx+Yn2Zn+e0O3l+zrvlzxyy2rf8vYg+/gc= \ No newline at end of file diff --git a/src/canvas/canvas_frame.rs b/src/canvas/canvas_frame.rs index 49b4c279..63253794 100644 --- a/src/canvas/canvas_frame.rs +++ b/src/canvas/canvas_frame.rs @@ -6,31 +6,35 @@ use crate::canvas::managed::shader::dynamic_vertex::RuntimeVertexDef; use crate::canvas::managed::handles::{CanvasTextureHandle, CanvasImageHandle, CanvasFontHandle, Handle}; use vulkano::pipeline::vertex::Vertex; use std::any::Any; -use crate::{VertexTypeContainer, Move, Geom}; +use crate::{VertexTypeContainer}; use winit::event::Event; -use crate::util::tr_event::TrEvent; +use crate::util::tr_event::{TrEvent, TrUIEvent}; +use crate::drawables::sprite::{Velocity, Geometry}; /// Trait which may be inherited by objects that wish to be drawn to the screen pub trait Drawable { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + + // Render expects the implementer to create custom render logic based on interior data within + // the struct. This data as of right now, will *only* be mutatable via events & update + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec; -} -/// Trait which may be inherited by objects that wish to receive events -pub trait Eventable { - fn notify(&mut self, event: &TrEvent) -> (); -} + // Update simply passes the delta time. The implementor doesn't necessarily need to use delta_time + // or even add anything other than a Vec::new() to the function. + fn update(&self, delta_time: f32) -> Vec>; -/// Trait which may be inherited by objects that wish to be updated -pub trait Updatable { - fn update(&mut self, delta_time: f32) -> (); + // Notify is where custom events created in other parts of the system will be ingested. It + // might be a good idea in the future to have some of pre-function-call filtering so we + // don't have as many notifies that just immediately reject. + fn notify(&self, tr_event : Vec>, ui_events: Vec>) -> Vec>; } + /// Accumulator for Vectors of VertexTypes #[derive(Default)] pub struct CanvasFrame { @@ -54,8 +58,8 @@ impl CanvasFrame { } /// Push this drawable onto the back of the accumulator - pub fn draw(&mut self, drawable: &dyn Drawable, mv: Move, geom: Geom) { - for i in drawable.get( + pub fn draw(&mut self, drawable: &dyn Drawable, mv: Velocity, geom: Geometry) { + for i in drawable.render( self.window_size, (mv.pos_x, mv.pos_y), geom.rotation, diff --git a/src/canvas/compu_frame.rs b/src/canvas/compu_frame.rs index 90a1b063..0dc16d89 100644 --- a/src/canvas/compu_frame.rs +++ b/src/canvas/compu_frame.rs @@ -4,7 +4,7 @@ use crate::canvas::managed::handles::{CompuKernelHandle}; use crate::drawables::compu_sprite::CompuSprite; use crate::canvas::canvas_frame::Drawable; use crate::util::vertex::VertexTypeContainer; -use crate::{Move, Geom}; +use crate::drawables::sprite::{Velocity, Geometry}; #[derive(Default)] pub struct CompuFrame { @@ -58,10 +58,10 @@ impl CompuFrame { buffer: Arc, kernel: Arc, sprite: &CompuSprite, - mv: Move, - geom: Geom, + mv: Velocity, + geom: Geometry, ) { - let compu_sprites = sprite.get( + let compu_sprites = sprite.render( self.window_size, (mv.pos_x, mv.pos_y), geom.rotation, diff --git a/src/drawables/compu_sprite.rs b/src/drawables/compu_sprite.rs index 414a2554..7a318313 100644 --- a/src/drawables/compu_sprite.rs +++ b/src/drawables/compu_sprite.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use crate::canvas::managed::handles::{CanvasImageHandle, CanvasTextureHandle}; use crate::canvas::canvas_frame::Drawable; use crate::util::vertex::{VertexTypeContainer, ImageVertex3D}; +use crate::util::tr_event::{TrUIEvent, TrEvent}; pub struct CompuSprite { @@ -53,13 +54,21 @@ impl CompuSprite { } impl Drawable for CompuSprite { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { vec![self.verts.clone()] } + + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + Vec::new() + } } \ No newline at end of file diff --git a/src/drawables/polygon.rs b/src/drawables/polygon.rs index f4979595..139eeccb 100644 --- a/src/drawables/polygon.rs +++ b/src/drawables/polygon.rs @@ -4,6 +4,7 @@ use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, Canva use crate::canvas::canvas_frame::{Drawable}; use crate::util::vertex::{VertexTypeContainer, TextureVertex3D, Vertex3D, ColorVertex3D}; use crate::drawables::sprite::Sprite; +use crate::util::tr_event::{TrUIEvent, TrEvent}; /// Convex multi verticy polygon #[derive(Debug, Clone)] @@ -61,16 +62,23 @@ impl Polygon { } } impl Drawable for Polygon { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { vec![self.verts.clone()] } + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + Vec::new() + } } diff --git a/src/drawables/rect.rs b/src/drawables/rect.rs index caffb660..721111f8 100644 --- a/src/drawables/rect.rs +++ b/src/drawables/rect.rs @@ -1,5 +1,6 @@ use crate::canvas::canvas_frame::Drawable; use crate::util::vertex::{VertexTypeContainer, ColorVertex3D}; +use crate::util::tr_event::{TrUIEvent, TrEvent}; /// #[derive(Debug, Clone)] @@ -73,12 +74,12 @@ impl Rect { } impl Drawable for Rect { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { vec![ VertexTypeContainer::ColorType( @@ -86,4 +87,12 @@ impl Drawable for Rect { ) ] } + + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + Vec::new() + } } diff --git a/src/drawables/slider.rs b/src/drawables/slider.rs index fcb6e552..59db95c4 100644 --- a/src/drawables/slider.rs +++ b/src/drawables/slider.rs @@ -2,11 +2,11 @@ use std::collections::HashSet; use winit::event::{Event, ElementState, MouseButton}; -use crate::canvas::canvas_frame::{Drawable, Eventable}; +use crate::canvas::canvas_frame::{Drawable}; use crate::drawables::rect::Rect; use crate::drawables::sprite::Sprite; use crate::util::vertex::VertexTypeContainer; -use crate::util::tr_event::{TrEvent, TrWindowEvent}; +use crate::util::tr_event::{TrEvent, TrWindowEvent, TrUIEvent}; #[derive(Debug, Clone)] pub struct Slider { @@ -67,14 +67,14 @@ impl Slider { } impl Drawable for Slider { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { - let mut vertices = self.handle.get( + let mut vertices = self.handle.render( window_size, position, rotation, @@ -84,30 +84,32 @@ impl Drawable for Slider { vertices.extend_from_slice( self.guide.iter() - .map(|x| x.get(window_size, - position, - rotation, - size, - depth, + .map(|x| x.render(window_size, + position, + rotation, + size, + depth, )).flatten() .collect::>() .as_slice() ); vertices.extend_from_slice( - self.guide[0].get(window_size, - position, - rotation, - size, - depth, + self.guide[0].render(window_size, + position, + rotation, + size, + depth, ).as_slice()); vertices } -} -impl Eventable for Slider { - fn notify(&mut self, event: &TrEvent) -> () { - match event { + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + match tr_event { TrEvent::WindowEvent { event: TrWindowEvent::MouseInput { device_id, state, button, modifiers }, .. } => { @@ -124,6 +126,6 @@ impl Eventable for Slider { } _ => {} } - + Vec::new() } } diff --git a/src/drawables/sprite.rs b/src/drawables/sprite.rs index f72f61fd..927b1f81 100644 --- a/src/drawables/sprite.rs +++ b/src/drawables/sprite.rs @@ -1,15 +1,31 @@ use std::sync::Arc; use crate::canvas::*; use crate::canvas::managed::handles::{CanvasFontHandle, CanvasImageHandle, CanvasTextureHandle, Handle}; -use crate::canvas::canvas_frame::{Drawable, Eventable, Updatable}; +use crate::canvas::canvas_frame::{Drawable}; use crate::util::vertex::{VertexTypeContainer, TextureVertex3D, Vertex3D}; use winit::event::{DeviceEvent, MouseButton, ElementState, Event, WindowEvent}; -use crate::util::tr_event::{TrEvent, TrWindowEvent}; +use crate::util::tr_event::{TrEvent, TrWindowEvent, TrUIEvent}; +pub struct Geometry { + pos_x: f32, + pos_y: f32, + size_x: f32, + size_y: f32, + rotation: f32, + depth: f32, +} + +pub struct Velocity { + vel_x: f32, + vel_y: f32, + vel_r: f32, +} /// #[derive(Debug, Clone)] pub struct Sprite { texture_handle: Arc, + geometry: Geometry, + velocity: Velocity, } /// Container class which implements drawable. @@ -62,18 +78,31 @@ impl Sprite { pub fn new(texture_handle: Arc) -> Sprite { Sprite { texture_handle: texture_handle.clone(), + geometry: Geometry { + pos_x: 0.0, + pos_y: 0.0, + size_x: 0.0, + size_y: 0.0, + rotation: 0.0, + depth: 0.0 + }, + velocity: Velocity { + vel_x: 0.0, + vel_y: 0.0, + vel_r: 0.0 + } } } } impl Drawable for Sprite { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { let normalized_depth = (depth / 255.0); @@ -83,11 +112,13 @@ impl Drawable for Sprite { self.texture_handle.clone()) ] } -} -impl Eventable for Sprite { - fn notify(&mut self, event: &TrEvent) -> () { - match event { + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + match tr_event { TrEvent::WindowEvent { event: TrWindowEvent::MouseInput { device_id, state, button, modifiers }, .. } => { match button { MouseButton::Left => { @@ -100,9 +131,6 @@ impl Eventable for Sprite { } _ => {} } + Vec::new() } } - -impl Updatable for Sprite { - fn update(&mut self, delta_time: f32) -> () {} -} diff --git a/src/drawables/text.rs b/src/drawables/text.rs index fbe8bebe..fc13d523 100644 --- a/src/drawables/text.rs +++ b/src/drawables/text.rs @@ -1,5 +1,6 @@ use crate::canvas::canvas_frame::Drawable; use crate::util::vertex::{VertexTypeContainer, ColorVertex3D}; +use crate::util::tr_event::{TrUIEvent, TrEvent}; /// #[derive(Debug, Clone)] @@ -137,13 +138,21 @@ impl Text { } impl Drawable for Text { - fn get(&self, - window_size: (u32, u32), - position: (f32, f32), - rotation: f32, - size: (f32, f32), - depth: f32, + fn render(&self, + window_size: (u32, u32), + position: (f32, f32), + rotation: f32, + size: (f32, f32), + depth: f32, ) -> Vec { vec![self.verts.clone()] } + + fn update(&self, delta_time: f32) -> Vec> { + Vec::new() + } + + fn notify(&self, tr_event: Vec>, ui_events: Vec>) -> Vec> { + Vec::new() + } } diff --git a/src/main.rs b/src/main.rs index 551e6e93..229a9a3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ use winit::event_loop::{ControlFlow, EventLoop, EventLoopProxy}; use winit::platform::unix::WindowBuilderExtUnix; use winit::window::{WindowBuilder, Window}; -use crate::canvas::canvas_frame::{CanvasFrame, Drawable, Eventable, Updatable}; +use crate::canvas::canvas_frame::{CanvasFrame, Drawable}; use crate::canvas::canvas_state::CanvasState; use crate::canvas::managed::handles::{CanvasFontHandle, CanvasTextureHandle, Handle}; use canvas::compu_frame::CompuFrame; @@ -46,41 +46,16 @@ pub mod vkprocessor; pub mod drawables; pub mod canvas; - extern crate specs; use specs::prelude::*; use vulkano::swapchain::Surface; - -//struct Draws(Box, Box + Sync + Send>); -struct SSprite(Box); - - - -impl Component for SSprite { - type Storage = VecStorage; -} - -pub struct Move { - vel_x: f32, - vel_y: f32, +pub struct Render { + render_actor: Box, } -impl Component for Move { - type Storage = VecStorage; -} - -pub struct Geom { - pos_x: f32, - pos_y: f32, - size_x: f32, - size_y: f32, - rotation: f32, - depth: f32, -} - -impl Component for Geom { +impl Component for Render { type Storage = VecStorage; } @@ -93,65 +68,23 @@ struct PersistentState { compu_frame: CompuFrame, } -// If I were to have multiple systems -/* - -One for rendering -One for updating -One for eventing - -Rendering is easy enough. It needs all the components necessary in order -to generate the vertices. This includes the position, size, and vertex generator - -Updating can probably be multiple types, I imagine something that implemented an Updatable -trait could then be used. - -So the big problem here is that I have two traits that I want to expose, BUT -I have to put the concrete value in both containers... I don't think this is something -that specs will like since it wants to be the only owner. No use in RefCell'ing it -because that's just stupid - -What if I turn this on it's head and really embrace the systems. So for example I could have -the User system. Ooof this is a big question actually... - -// Components that want to be updated -Move - -// want to be drawn -Drawable -Geom - -Notifyable - - - -*/ - - - - - - - struct RenderSystem; impl<'a> System<'a> for RenderSystem { type SystemData = ( - WriteStorage<'a, Move>, // its velocity - WriteStorage<'a, Geom>, // its size, position & rotation - WriteStorage<'a, SSprite>, // generates the vertices - Write<'a, PersistentState>, // delta_time, window size, etc. - Write<'a, VkProcessor>, // Renderer + WriteStorage<'a, Render>, // generates the vertices + Write<'a, PersistentState>, // delta_time, window size, etc. + Write<'a, VkProcessor>, // Renderer ); - fn run(&mut self, (mut mv, mut geom, mut draw, mut state, mut vk_processor): Self::SystemData) { + fn run(&mut self, (mut mv, mut draw, mut state, mut vk_processor): Self::SystemData) { state.canvas_frame = CanvasFrame::new(state.window_size); state.compu_frame = CompuFrame::new(state.window_size); // compu_frame.add_with_image_swap(compute_buffer.clone(), compute_kernel.clone(), &compu_sprite1); // compu_frame.add(compute_buffer.clone(), compute_kernel.clone()); - for (mv, geom, draw) in (&mut mv, &mut geom, &mut draw).join() { + for (mv, geom, draw) in (&mut mv, &mut draw).join() { geom.pos_x += mv.vel_x * state.delta_time; geom.pos_y += mv.vel_y * state.delta_time; @@ -180,18 +113,18 @@ struct EventSystem; impl<'a> System<'a> for EventSystem { type SystemData = ( - WriteStorage<'a, SSprite>, + WriteStorage<'a, Render>, Write<'a, PersistentState>, Write<'a, VkProcessor>, Write<'a, Vec>> ); fn run(&mut self, (mut draw, mut state, mut vk_processor, event_stack): Self::SystemData) { - for draw_data in (&mut draw).join() { - for event in event_stack.iter() { - draw_data.1.notify(event) - } - } + // for draw_data in (&mut draw).join() { + // for event in event_stack.iter() { + // draw_data.0.notify(event) + // } + // } } } @@ -263,9 +196,7 @@ pub fn main() { processor.get_texture_handle(String::from("sfml.png")).unwrap(); let mut world = World::new(); - world.register::(); - world.register::(); - world.register::(); + world.register::(); world.insert::(processor); world.insert::>>(Vec::new()); world.insert::(PersistentState { @@ -281,23 +212,13 @@ pub fn main() { // An entity may or may not contain some component. let t = world.create_entity() - .with(Move { vel_x: 0.0, vel_y: 0.0}) - .with(Geom { size_x: 100.0, size_y: 100.0, rotation: 0.0, depth: 1.0, pos_x: 100.0, pos_y: 400.0 }) - .with(SSprite(thing.clone(), thing.clone())) - .build(); - - world.create_entity() - .with(Move { vel_x: 0.0, vel_y: 0.0 }) - .with(Geom { size_x: 100.0, size_y: 100.0, rotation: 0.0, depth: 1.0, pos_x: 100.0, pos_y: 400.0 }) - .with(SSprite(thing.clone(), thing)) + .with(Render{ render_actor: thing })// just a drawable .build(); let thing2 = Box::new(Slider::new((300.0, 50.0), (550.0, 100.0), 30000)); world.create_entity() - .with(Move { vel_x: 0.0, vel_y: 0.0 }) - .with(Geom { size_x: 100.0, size_y: 100.0, rotation: 0.0, depth: 1.0, pos_x: 100.0, pos_y: 400.0 }) - .with(SSprite(thing2.clone(), thing2)) + .with(Render{ render_actor: thing2 })// just a drawable .build(); @@ -352,7 +273,7 @@ pub fn main() { world.write_resource::() .window_size = surface.window().inner_size().into(); } else { - // println!("{}", world.write_resource::>>().len()); + // println!("{}", world.write_resource::>>().len()); world.write_resource::>>().clear(); } } @@ -362,8 +283,7 @@ pub fn main() { Event::WindowEvent { event: WindowEvent::MouseInput { device_id, state, button, modifiers }, .. } => { match button { MouseButton::Left => { - if state == ElementState::Pressed { - } + if state == ElementState::Pressed {} } _ => {} } diff --git a/src/util/tr_event.rs b/src/util/tr_event.rs index cb1a6723..50fc31ce 100644 --- a/src/util/tr_event.rs +++ b/src/util/tr_event.rs @@ -5,6 +5,11 @@ use winit::dpi::{PhysicalPosition, PhysicalSize}; use gilrs::Event as GilEvent; use vulkano::pipeline::shader::GeometryShaderExecutionMode::TrianglesWithAdjacency; +#[derive(Clone)] +pub enum TrUIEvent { + UIEvent(T) +} + #[derive(Clone)] pub enum TrEventExtension {