From b089bc20865a98be2f42dac7f5d35deff5efb33a Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 8 Nov 2025 23:42:50 -0500 Subject: graphics: have window default to minimum size --- graphics/src/lib.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'graphics/src/lib.rs') diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index a9567eb..2051177 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -42,9 +42,9 @@ impl Window { /// /// let window = Window::new(800, 600, "Dungeon Crawl").unwrap(); /// ``` - pub fn new(width: i32, height: i32, title: &str) -> crate::Result { + pub fn new(width: u16, height: u16, title: &str) -> crate::Result { let (mut handle, thread) = raylib::init() - .size(width, height) + .size(width.into(), height.into()) .title(title) .resizable() .log_level(TraceLogLevel::LOG_WARNING) @@ -65,6 +65,18 @@ impl Window { }) } + /// Instantiates a new window with a default tile and size + /// + /// # Examples + /// ```no_run + /// use graphics::Window; + /// + /// let window = Window::new_default().unwrap(); + /// ``` + pub fn new_default() -> crate::Result { + Self::new(render::RENDER_WIDTH, render::RENDER_HEIGHT, "Dungeon Crawl") + } + /// Returns if the window should be closed. /// This usually means the 'x' button has been pressed. pub fn is_open(&self) -> bool { -- cgit v1.2.3-freya