bevy_codex/pause/
components.rs

1use bevy::prelude::Component;
2
3#[derive(Component)]
4pub struct Pause;
5
6#[derive(Component, Clone)]
7pub struct PauseUi;
8
9#[derive(Component)]
10pub struct ResumeButton;
11
12// #=====================#
13// #=== INTERACTIVITY ===#
14
15/// Good practice is to use custom component for buttons, so we can easily know what type of button was pressed
16#[derive(Component, Debug, Default, Clone, PartialEq)]
17pub enum PauseButton {
18    #[default]
19    Resume,
20    Settings,
21    Menu,
22}
23impl PauseButton {
24    pub fn str(&self) -> String {
25        match self {
26            PauseButton::Resume => "Resume".into(),
27            PauseButton::Settings => "Settings".into(),
28            PauseButton::Menu => "Return to menu".into(),
29        }
30    }
31}