summaryrefslogtreecommitdiff
path: root/graphics/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/lib.rs')
-rw-r--r--graphics/src/lib.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs
index 2633e8d..b42845c 100644
--- a/graphics/src/lib.rs
+++ b/graphics/src/lib.rs
@@ -89,36 +89,42 @@ pub struct WindowBuilder<'a> {
}
impl<'a> WindowBuilder<'a> {
/// Default window builder
- pub fn new() -> Self {
- Self::default()
+ pub const fn new() -> Self {
+ Self {
+ title: "Dungeon Crawl",
+ width: render::RENDER_WIDTH,
+ height: render::RENDER_HEIGHT,
+ vsync: false,
+ verbose: false,
+ }
}
/// Set the window title
- pub fn title(&mut self, title: &'a str) -> &mut Self {
+ pub const fn title(&mut self, title: &'a str) -> &mut Self {
self.title = title;
self
}
/// Set the default window width
- pub fn width(&mut self, width: u16) -> &mut Self {
+ pub const fn width(&mut self, width: u16) -> &mut Self {
self.width = width;
self
}
/// Set the default window height
- pub fn height(&mut self, height: u16) -> &mut Self {
+ pub const fn height(&mut self, height: u16) -> &mut Self {
self.height = height;
self
}
/// Toggle vsync support
- pub fn vsync(&mut self, vsync: bool) -> &mut Self {
+ pub const fn vsync(&mut self, vsync: bool) -> &mut Self {
self.vsync = vsync;
self
}
/// Toggle verbose logging
- pub fn verbose(&mut self, verbose: bool) -> &mut Self {
+ pub const fn verbose(&mut self, verbose: bool) -> &mut Self {
self.verbose = verbose;
self
}
@@ -164,13 +170,7 @@ impl<'a> WindowBuilder<'a> {
}
impl Default for WindowBuilder<'_> {
fn default() -> Self {
- Self {
- title: "Dungeon Crawl",
- width: render::RENDER_WIDTH,
- height: render::RENDER_HEIGHT,
- vsync: false,
- verbose: false,
- }
+ Self::new()
}
}
@@ -198,7 +198,7 @@ impl Window {
}
/// Toggles the debug UI
- pub fn toggle_debug(&mut self) {
+ pub const fn toggle_debug(&mut self) {
self.renderer.toggle_debug();
}
@@ -228,7 +228,7 @@ impl Window {
}
/// Get audio data for the window
- pub fn audio(&self) -> &Audio {
+ pub const fn audio(&self) -> &Audio {
&self.audio
}
}