| 108 | } |
| 109 | |
| 110 | pub trait Example: 'static + Sized { |
| 111 | fn title() -> &'static str { |
| 112 | "Example" |
| 113 | } |
| 114 | |
| 115 | fn new(app: &App) -> Self; |
| 116 | fn resize(&mut self, _: &App) {} |
| 117 | fn event(&mut self, _: &App, _: winit::event::WindowEvent) {} |
| 118 | fn update(&mut self, _: &App) {} |
| 119 | fn render(&mut self, platform: &App, view: &wgpu::TextureView); |
| 120 | } |
| 121 | |
| 122 | fn run<E: Example>(event_loop: EventLoop, app: App) { |
| 123 | let mut example = E::new(&app); |