bevy_codex/main_menu/
components.rs

1use bevy::prelude::Component;
2
3#[derive(Component)]
4pub struct MainMenu;
5
6#[derive(Component, Clone)]
7pub struct MainMenuUi;
8
9// #=====================#
10// #=== INTERACTIVITY ===#
11
12/// Good practice is to use custom component for buttons, so we can easily know what type of button was pressed
13#[derive(Component, Debug, Default, Clone, PartialEq)]
14pub enum MainMenuButton {
15    Continue,
16    #[default]
17    NewGame,
18    LoadGame,
19    Settings,
20    AdditionalContent,
21    Credits,
22    QuitGame,
23}
24impl MainMenuButton {
25    pub fn str(&self) -> String {
26        match self {
27            MainMenuButton::Continue => "CONTINUE".into(),
28            MainMenuButton::NewGame => "New Game".into(),
29            MainMenuButton::LoadGame => "LOAD GAME".into(),
30            MainMenuButton::Settings => "Settings".into(),
31            MainMenuButton::AdditionalContent => "ADDITIONAL CONTENT".into(),
32            MainMenuButton::Credits => "CREDITS".into(),
33            MainMenuButton::QuitGame => "Quit".into(),
34        }
35    }
36}