summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/src/lib.rs32
1 files changed, 26 insertions, 6 deletions
diff --git a/engine/src/lib.rs b/engine/src/lib.rs
index 806d7ec..2016ec1 100644
--- a/engine/src/lib.rs
+++ b/engine/src/lib.rs
@@ -51,11 +51,7 @@ where
///
/// # Errors
/// Will return `Err` if window creation or window configuration fails.
- pub fn new(
- window_size: &WindowSize,
- window_title: &str,
- camera: CameraT,
- ) -> Result<Self, Error>
+ pub fn new(window_settings: &WindowSettings, camera: CameraT) -> Result<Self, Error>
{
let window_builder = WindowBuilder::new();
@@ -64,7 +60,7 @@ where
window_builder.hint(glfw::window::Hint::OpenGLDebugContext, 1);
let window = window_builder
- .create(window_size, window_title)
+ .create(&window_settings.size, &window_settings.title)
.map_err(Error::CreateWindowFailed)?;
window
@@ -247,3 +243,27 @@ pub enum Error
#[error("Rendering failed")]
RenderingFailed(#[source] renderer::Error),
}
+
+#[derive(Debug)]
+pub struct WindowSettings
+{
+ size: WindowSize,
+ title: Box<str>,
+}
+
+#[derive(Debug, Default)]
+pub struct WindowSettingsBuilder {}
+
+impl WindowSettingsBuilder
+{
+ #[must_use]
+ pub fn new() -> Self
+ {
+ Self::default()
+ }
+
+ pub fn build(&self, size: WindowSize, title: impl Into<Box<str>>) -> WindowSettings
+ {
+ WindowSettings { size, title: title.into() }
+ }
+}