summaryrefslogtreecommitdiff
path: root/engine/src/renderer/mod.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-10-07 20:05:52 +0200
committerHampusM <hampus@hampusmat.com>2023-10-07 20:05:52 +0200
commit146635292369cc8a9660139d97cd9662025bd591 (patch)
tree65da7bde1a542cdfbabfc629d486dd6a7fd18b26 /engine/src/renderer/mod.rs
parentb34b393f7b07495ca92ff5b0ce79d4c391abe0ca (diff)
fix(engine): update viewport when framebuffer changes size
Diffstat (limited to 'engine/src/renderer/mod.rs')
-rw-r--r--engine/src/renderer/mod.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/engine/src/renderer/mod.rs b/engine/src/renderer/mod.rs
index c34441c..9cd379d 100644
--- a/engine/src/renderer/mod.rs
+++ b/engine/src/renderer/mod.rs
@@ -1,6 +1,8 @@
use std::ffi::{c_void, CString};
use std::process::abort;
+use glfw::WindowSize;
+
use crate::vector::Vec2;
pub fn initialize(window: &glfw::Window) -> Result<(), Error>
@@ -35,15 +37,7 @@ pub fn render()
}
}
-/// Renderer error.
-#[derive(Debug, thiserror::Error)]
-pub enum Error
-{
- #[error("Failed to get window size")]
- GetWindowSizeFailed(#[source] glfw::Error),
-}
-
-fn set_viewport(position: &Vec2<u32>, size: &crate::WindowSize)
+pub fn set_viewport(position: &Vec2<u32>, size: &WindowSize)
{
unsafe {
#[allow(clippy::cast_possible_wrap)]
@@ -55,3 +49,11 @@ fn set_viewport(position: &Vec2<u32>, size: &crate::WindowSize)
);
}
}
+
+/// Renderer error.
+#[derive(Debug, thiserror::Error)]
+pub enum Error
+{
+ #[error("Failed to get window size")]
+ GetWindowSizeFailed(#[source] glfw::Error),
+}