Add a lot of thing
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s

This commit is contained in:
Florian RICHER 2024-11-15 13:59:19 +01:00
parent 09e109d6ef
commit fb4ac29c07
6 changed files with 255 additions and 43 deletions

View file

@ -6,7 +6,7 @@ use winit::window::WindowId;
pub struct Window {
handle: Option<winit::window::Window>,
window_attributes: winit::window::WindowAttributes
window_attributes: winit::window::WindowAttributes,
}
impl Window {
@ -49,20 +49,15 @@ impl Window {
pub fn handle(&self) -> Option<&winit::window::Window> {
self.handle.as_ref()
}
pub fn size(&self) -> Option<winit::dpi::Size> {
self.window_attributes.inner_size
}
pub fn window_event(&mut self, _event_loop: &ActiveEventLoop, _id: WindowId, event: WindowEvent) {
match event {
WindowEvent::RedrawRequested => {
match self.handle.as_ref() {
Some(window) => window.request_redraw(),
None => log::warn!("Redraw requested but no window found")
}
}
_ => (),
pub fn request_redraw(&self) {
match self.handle.as_ref() {
Some(window) => window.request_redraw(),
None => log::warn!("Redraw requested but no window found")
}
}
}