mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-09 20:38:30 +00:00
Simplify API of Viewer
This commit is contained in:
parent
d19cd87020
commit
7b9613038c
@ -9,7 +9,7 @@ use winit::{
|
|||||||
event::{
|
event::{
|
||||||
ElementState, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent,
|
ElementState, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent,
|
||||||
},
|
},
|
||||||
event_loop::{ActiveEventLoop, EventLoop, EventLoopClosed, EventLoopProxy},
|
event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy},
|
||||||
keyboard::{Key, NamedKey},
|
keyboard::{Key, NamedKey},
|
||||||
window::WindowId,
|
window::WindowId,
|
||||||
};
|
};
|
||||||
@ -60,11 +60,11 @@ impl Viewer {
|
|||||||
///
|
///
|
||||||
/// This can fail, if the viewer thread is no longer running. Returns the
|
/// This can fail, if the viewer thread is no longer running. Returns the
|
||||||
/// triangle mesh, wrapped in an error, if that is the case.
|
/// triangle mesh, wrapped in an error, if that is the case.
|
||||||
pub fn display(
|
pub fn display(&self, tri_mesh: TriMesh) {
|
||||||
&self,
|
// If there's an error, that means the display thread has closed down
|
||||||
tri_mesh: TriMesh,
|
// and we're on our way to shutting down as well. I don't think there's
|
||||||
) -> Result<(), EventLoopClosed<TriMesh>> {
|
// much we can do about that.
|
||||||
self.event_loop.send_event(tri_mesh)
|
let _ = self.event_loop.send_event(tri_mesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ impl Instance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_viewer_and_spawn_thread(|viewer| {
|
make_viewer_and_spawn_thread(|viewer| {
|
||||||
let _ = viewer.display(tri_mesh);
|
viewer.display(tri_mesh);
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user