-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
157 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,19 @@ | ||
use crate::prelude::*; | ||
|
||
mod menu; | ||
mod navigation; | ||
mod widgets; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_plugins((navigation::plugin, widgets::plugin)); | ||
app.add_systems(OnEnter(GameState::Startup), init); | ||
app.add_plugins((menu::plugin, navigation::plugin, widgets::plugin)); | ||
} | ||
|
||
pub mod prelude { | ||
pub use bevy_trait_query::RegisterExt; | ||
|
||
pub use super::{ | ||
menu::MenuState, | ||
navigation::{NavBundle, NavContainer, Navigable}, | ||
widgets::{Container, NavigableExt, Stylable, Widget}, | ||
}; | ||
} | ||
|
||
fn init(mut cmd: Commands) { | ||
let mut root = cmd.ui_root(); | ||
root.with_children(|node| { | ||
node.button("hey"); | ||
node.button("hi").no_nav(); | ||
node.button("hello"); | ||
}) | ||
.nav_container(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use crate::prelude::*; | ||
|
||
mod main; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_sub_state::<MenuState>() | ||
.enable_state_scoped_entities::<MenuState>() | ||
.add_plugins(main::plugin); | ||
} | ||
|
||
#[derive(SubStates, Std!, Default)] | ||
#[source(GameState = GameState::Menu)] | ||
pub enum MenuState { | ||
/// Main menu screen, used to play or exit the game and access other options | ||
#[default] | ||
Main, | ||
/// Menu screen to customize game options | ||
Options, | ||
/// Menu screen to view keys assigned to actions | ||
Mappings, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::prelude::*; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_systems(OnEnter(MenuState::Main), init); | ||
} | ||
|
||
fn init(mut cmd: Commands) { | ||
cmd.ui_root() | ||
.with_children(|root| { | ||
root.button("hey"); | ||
root.button("hi"); | ||
root.button("hello"); | ||
}) | ||
.nav_container() | ||
.insert(StateScoped(MenuState::Main)); | ||
} |