Walking Through the Pipeline
28 Jun 2025When you call cargo run
, here is what mirador does:
-
event_loop
andapp
is initialized, and the app is ran with the event loop. (main.rs) On initialization the app does not have neither a window nor a state. It isn’t until the app is ran with an event loop that it can create a window and a state. -
Since the app now has an event loop the first thing it does is call the
resumed(&mut self, event_loop: &ActiveEventLoop)
method. This method is responsible for initializing the app’s state and creating the window. (app.rs) The initialization of theAppState
is where all of the renderer’s, and the game state are initialized. -
Now that the app is fully initialized and has a state and a window it awaits the next event from the event loop. After all events in the current frame have been processed it calls
self.handle_redraw();
which begins the next frame. On each redraw the wgpu_renderer callsupdate_canvas(...)
which then decides what to render based on the current game state. (i.e. ifloading
it renders the loading animation, and otherwise it renders the game itself)