Understand the `bevy_ratatui` application pattern
mainThe bevy_ratatui integration follows a specific flow through the Bevy schedules to handle terminal input and rendering. This pattern is applicable to games, dashboards, and editors:
- Initialization:
RatatuiPluginsinitializes the terminal context and emits terminal events (e.g.,KeyMessage). - Input Translation: A
PreUpdatesystem translates terminal-specific messages (likeKeyMessage) into your application's domain-specific messages (e.g.,GameCommand). This decouples terminal key codes from your core logic. - State Update: Chained
Updatesystems synchronize terminal-dependent resources, read your application commands, and advance the application state in a deliberate order. - Rendering: A
PostUpdatesystem borrowsRatatuiContextand callsdraw. This ensures rendering sees the state produced by the current update cycle without the rendering system owning or mutating the application rules.