Mirador follows a hierarchical architecture where the App
struct serves as the top-level container for the entire program, while AppState
contains the operational components including rendering pipelines, game logic, and user interface systems.
The App
struct is the top-level struct of the entire program and serves as the main application object for Mirador. It manages the fundamental WGPU instance, window system integration, and implements the event-driven architecture through winit::application::ApplicationHandler
.
#[derive(Default)]
pub struct App {
instance: wgpu::Instance,
state: Option<AppState>,
window: Option<Arc<Window>>,
}
AppState
which contains all operational componentsThe AppState
struct contains the meat of the application including the various rendering pipelines, the game state, and all UI elements. This is where all the active components of a running game session reside.
pub struct AppState {
wgpu_renderer: WgpuRenderer,
egui_renderer: EguiRenderer,
ui: UiState,
game_state: GameState,
key_state: KeyState,
}
Rendering Pipelines:
wgpu_renderer
: Handles all 3D graphics rendering including the maze geometry, starfield backgrounds, maze animations, and depth-tested 3D scenes. [See renderer for more information. ]egui_renderer
: Manages the immediate-mode GUI system for all user interface overlays, menus, and debug panels. [See User Interface (egui) for more information. ]Application State:
ui
: Contains all UI component states including sliders, color pickers, configuration panels, and user preferencesgame_state
: Encapsulates the core game logic including player position/orientation, maze data, timing systems, and game progressionkey_state
: Tracks current input state including pressed keys, mouse position, and input event handlingThe application follows this initialization and operation flow:
App
Creation: The top-level App
struct is instantiated with default valuesAppState
Initialization: All rendering pipelines, game systems, and UI components are initializedThis separation allows for clean resource management where the App
handles system-level concerns while AppState
focuses on application-specific functionality.