added comments to clearify what is in each rust file

This commit is contained in:
grimsace
2026-05-18 09:01:14 -05:00
parent 665a3a3bfa
commit 49ebe351d6
15 changed files with 94 additions and 0 deletions
+6
View File
@@ -1,3 +1,9 @@
/*
* Contains the core DungeonApp struct and its eframe::App implementation.
* This file manages the application lifecycle, main state, undo/redo stacks,
* and high-level level management (generation, deletion, and refreshing).
*/
use std::collections::HashSet;
use std::sync::mpsc;
use std::thread;
+7
View File
@@ -1,3 +1,10 @@
/*
* Image and vector export module.
* Handles building SVG representations of dungeon levels and
* exporting them to various formats (PNG, JPEG, WebP, SVG)
* via a background thread to maintain UI responsiveness.
*/
use std::collections::HashSet;
use std::fmt::Write as _;
use std::path::PathBuf;
+9
View File
@@ -1,3 +1,12 @@
/*
* Manages user interaction and grid-based logic for the dungeon canvas.
* Includes logic for:
* - Dragging and moving rooms, corridors, markers, and text.
* - Resizing rooms, text, and staircases.
* - Handling "Add" tool operations (placing new rooms, doors, etc.).
* - Hit testing and hover detection for all dungeon elements.
*/
use crate::app::{DungeonApp, ManualDoorKind};
use crate::layout::{
self, blocked_room_cells, corridor_cells, rects_overlap, room_index_at_cell, rooms_overlap,
+7
View File
@@ -1,3 +1,10 @@
/*
* High-level procedural generation algorithms.
* Contains the logic for building room connection graphs,
* placing packed rooms, and populating random markers, traps,
* monsters, and staircase transitions between levels.
*/
use super::types::{
AreaMarker, Corridor, Door, DoorSettings, DungeonLayout, Room, Staircase, Window,
WindowSettings, WindowSide,
+6
View File
@@ -1,4 +1,10 @@
pub mod generation;
/*
* Public entry point for the layout module.
* Exports types, utilities, and generation algorithms used to build
* the dungeon structure.
*/
pub mod types;
pub mod utils;
+6
View File
@@ -1,3 +1,9 @@
/*
* Core data structures for the dungeon layout.
* Defines structs for Rooms, Corridors, Doors, Windows, Stairs,
* TextLabels, and the master DungeonLayout container.
*/
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+6
View File
@@ -1,3 +1,9 @@
/*
* Geometric utilities and low-level layout helpers.
* Provides logic for Manhattan distance, room overlap testing,
* BFS-based shortest pathfinding, and custom deterministic RNG.
*/
use super::types::{DungeonLayout, Room};
use std::collections::{HashSet, VecDeque};
+6
View File
@@ -1,3 +1,9 @@
/*
* Entry point for the Desktop Dungeon Generator.
* Handles application initialization, module declarations,
* and starts the eframe/egui event loop.
*/
mod app;
mod exporter;
mod interact;
+6
View File
@@ -1,3 +1,9 @@
/*
* Canvas drawing logic for the dungeon layout.
* Provides functions to render rooms, corridors, walls, doors, windows,
* and various markers using egui's Painter API.
*/
use crate::interact::{
GridGeometry, HoverMarker, MarkerKind, cell_center, cell_rect, door_edges_for,
door_render_width, marker_rect, normalized_edge, window_render_width,
+6
View File
@@ -3,6 +3,12 @@ use serde::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
/*
* Persistence logic for dungeon state.
* Handles saving and loading the complete dungeon state
* (settings and layout data) to and from disk using JSON.
*/
use crate::layout::DungeonLayout;
use crate::ui::UiSettings;
+6
View File
@@ -1,3 +1,9 @@
/*
* Deterministic seed management.
* Provides functions to generate random master seeds and
* derive sub-seeds for specific procedural generation steps.
*/
use std::time::{SystemTime, UNIX_EPOCH};
// Generate a random master seed from time and process id.
+6
View File
@@ -1,3 +1,9 @@
/*
* Application-level persistent configuration.
* Manages the loading and saving of UiSettings to the system's
* local data directory.
*/
use std::fs;
use std::io;
use std::path::PathBuf;
+5
View File
@@ -1,3 +1,8 @@
/*
* The primary UI module. Defines the UiSettings structure and
* manages the side panel layout, legend panel, and level selection tabs.
* Serves as the entry point for all UI-related rendering.
*/
use eframe::egui;
use serde::{Deserialize, Serialize};
+6
View File
@@ -1,4 +1,10 @@
use super::{AddTool, ExportFormat, MaskFormat, SidePanelResult, UiSettings};
/*
* Individual tab rendering logic for the side panel.
* Contains functions for drawing the "Generate", "Layout", "Add",
* "Start & End", and "Monsters & Traps" control panels.
*/
use crate::seed;
use eframe::egui;
use egui::RichText;
+6
View File
@@ -1,3 +1,9 @@
/*
* Reusable UI components and drawing helpers.
* Includes logic for legend entries (standard and colorblind-friendly)
* and custom line styling (dashed, dotted, dash-dot patterns).
*/
use eframe::egui;
use egui::{Color32, Stroke};