|
|
@@ -0,0 +1,38 @@
|
|
|
+use winit::application::ApplicationHandler;
|
|
|
+use winit::event::{Event, WindowEvent, DeviceEvent, DeviceId};
|
|
|
+use winit::event_loop::{EventLoop, ActiveEventLoop};
|
|
|
+use winit::window::{Window, WindowAttributes, WindowId};
|
|
|
+
|
|
|
+#[derive(Default)]
|
|
|
+struct State{
|
|
|
+ window: Option<Window>,
|
|
|
+ counter: i32
|
|
|
+}
|
|
|
+impl ApplicationHandler for State{
|
|
|
+ fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
|
|
+ let window_attr = Window::default_attributes().with_title("truc").with_inner_size(winit::dpi::LogicalSize::new(128, 128));
|
|
|
+ self.window = Some(event_loop.create_window(window_attr).unwrap())
|
|
|
+ }
|
|
|
+ fn window_event(
|
|
|
+ &mut self,
|
|
|
+ event_loop: &ActiveEventLoop,
|
|
|
+ window_id: WindowId,
|
|
|
+ event: WindowEvent,
|
|
|
+ ) {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+pub fn run(){
|
|
|
+ env_logger::init();
|
|
|
+
|
|
|
+ let event_loop = EventLoop::new().unwrap();
|
|
|
+
|
|
|
+ let window_attributes = Window::default_attributes()
|
|
|
+ .with_title("Fantastic window number one!")
|
|
|
+ .with_inner_size(winit::dpi::LogicalSize::new(128.0, 128.0));
|
|
|
+
|
|
|
+ let mut state = State::default();
|
|
|
+ let _ = event_loop.run_app(&mut state);
|
|
|
+
|
|
|
+}
|