diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-07 20:05:52 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-07 20:05:52 +0200 |
commit | 146635292369cc8a9660139d97cd9662025bd591 (patch) | |
tree | 65da7bde1a542cdfbabfc629d486dd6a7fd18b26 /engine/src/lib.rs | |
parent | b34b393f7b07495ca92ff5b0ce79d4c391abe0ca (diff) |
fix(engine): update viewport when framebuffer changes size
Diffstat (limited to 'engine/src/lib.rs')
-rw-r--r-- | engine/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/engine/src/lib.rs b/engine/src/lib.rs index 618bc75..ea74fd1 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -3,6 +3,8 @@ use glfw::Window; pub use glfw::WindowSize; +use crate::vector::Vec2; + mod renderer; pub mod vector; @@ -27,6 +29,10 @@ impl Engine .make_context_current() .map_err(Error::ConfigureWindowFailed)?; + window.set_framebuffer_size_callback(move |new_window_size| { + crate::renderer::set_viewport(&Vec2::ZERO, &new_window_size); + }); + crate::renderer::initialize(&window).map_err(Error::InitializeRendererFailed)?; Ok(Self { window }) |