summaryrefslogtreecommitdiff
path: root/graphics/src/lib.rs
diff options
context:
space:
mode:
authoralf9310 <alf9310@rit.edu>2025-10-17 14:34:19 -0400
committeralf9310 <alf9310@rit.edu>2025-10-17 14:34:19 -0400
commita4538b90420f159b4449c80739fb208ec1c01d70 (patch)
tree65275ee11f2cf109c73647dd8e57c8d15a4b9e1c /graphics/src/lib.rs
parentGame name (diff)
downloadDungeonCrawl-a4538b90420f159b4449c80739fb208ec1c01d70.tar.gz
DungeonCrawl-a4538b90420f159b4449c80739fb208ec1c01d70.tar.bz2
DungeonCrawl-a4538b90420f159b4449c80739fb208ec1c01d70.zip
Added render documentation
Diffstat (limited to 'graphics/src/lib.rs')
-rw-r--r--graphics/src/lib.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs
index 5f44e41..4f55388 100644
--- a/graphics/src/lib.rs
+++ b/graphics/src/lib.rs
@@ -1,9 +1,14 @@
+//! The `graphics` crate contains the core functionality for
+//! rendering using the `raylib` library.
+
use raylib::prelude::*;
use crate::render::{FrameInfo, Renderer};
pub mod render;
+/// The `Window` type represents the game window
+#[derive(Debug)]
pub struct Window {
handle: RaylibHandle,
thread: RaylibThread,
@@ -12,6 +17,13 @@ pub struct Window {
impl Window {
/// Instantiates a new window provided with the default
/// window `width`, `height`, and `title`.
+ ///
+ /// # Examples
+ /// ```no_run
+ /// use graphics::Window;
+ ///
+ /// let window = Window::new(800, 600, "Dungeon Crawl");
+ /// ```
pub fn new(width: i32, height: i32, title: &str) -> Self {
let (handle, thread) = raylib::init()
.size(width, height)
@@ -30,6 +42,14 @@ impl Window {
}
/// Returns the renderer for the game
+ ///
+ /// # Examples
+ /// ```no_run
+ /// use graphics::Window;
+ ///
+ /// let mut window = Window::new(800, 600, "Dungeon Crawl");
+ /// let mut renderer = window.renderer();
+ /// ```
pub fn renderer(&mut self) -> Renderer<'_> {
let info = FrameInfo::new(&self.handle);
let handle = self.handle.begin_drawing(&self.thread);