Add a lot of thing
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
This commit is contained in:
parent
09e109d6ef
commit
fb4ac29c07
6 changed files with 255 additions and 43 deletions
|
@ -1,9 +1,9 @@
|
|||
use crate::display::window::Window;
|
||||
use crate::vulkan::VkRenderContext;
|
||||
use winit::application::ApplicationHandler;
|
||||
use winit::event::WindowEvent;
|
||||
use winit::event_loop::ActiveEventLoop;
|
||||
use winit::window::{WindowId};
|
||||
use crate::display::window::Window;
|
||||
use crate::vulkan::VkRenderContext;
|
||||
use winit::window::WindowId;
|
||||
|
||||
pub struct App {
|
||||
window: Window,
|
||||
|
@ -34,7 +34,29 @@ impl ApplicationHandler for App {
|
|||
log::debug!("The close button was pressed; stopping");
|
||||
event_loop.exit();
|
||||
}
|
||||
_ => self.window.window_event(event_loop, id, event),
|
||||
WindowEvent::Resized(size) => {
|
||||
match self.render_context.as_mut() {
|
||||
Some(render_context) => {
|
||||
if let Err(error) = render_context.update_resolution(size.width, size.height) {
|
||||
log::error!("Failed to update resolution of render context : {}", error);
|
||||
}
|
||||
}
|
||||
None => log::warn!("Window resized but no render context found")
|
||||
};
|
||||
}
|
||||
WindowEvent::RedrawRequested => {
|
||||
match self.render_context.as_mut() {
|
||||
Some(render_context) => {
|
||||
if let Err(error) = render_context.render() {
|
||||
log::error!("Failed to render with render context : {}", error);
|
||||
}
|
||||
}
|
||||
None => log::warn!("Window resized but no render context found")
|
||||
};
|
||||
|
||||
self.window.request_redraw();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue