mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-12 13:58:28 +00:00
Create event loop
This commit is contained in:
parent
99275c1404
commit
3c0ff8bffc
@ -1,5 +1,38 @@
|
|||||||
|
use winit::{
|
||||||
|
application::ApplicationHandler,
|
||||||
|
event::WindowEvent,
|
||||||
|
event_loop::{ActiveEventLoop, EventLoop},
|
||||||
|
window::{Window, WindowAttributes, WindowId},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::mesh::Mesh;
|
use crate::mesh::Mesh;
|
||||||
|
|
||||||
pub fn render(_: &Mesh) -> anyhow::Result<()> {
|
pub fn render(_: &Mesh) -> anyhow::Result<()> {
|
||||||
|
let event_loop = EventLoop::new()?;
|
||||||
|
|
||||||
|
let mut app = App { window: None };
|
||||||
|
event_loop.run_app(&mut app)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct App {
|
||||||
|
window: Option<Window>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ApplicationHandler for App {
|
||||||
|
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||||
|
let window = event_loop
|
||||||
|
.create_window(WindowAttributes::default())
|
||||||
|
.unwrap();
|
||||||
|
self.window = Some(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn window_event(
|
||||||
|
&mut self,
|
||||||
|
_: &ActiveEventLoop,
|
||||||
|
_: WindowId,
|
||||||
|
_: WindowEvent,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user