-
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
25 changed files
with
161 additions
and
101 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,5 +1,3 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::prelude::*; | ||
|
||
/// Adds the `PlaySet` to the `App`. | ||
|
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,5 +1,3 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::prelude::*; | ||
|
||
/// Adds the `GameState` to the `App`. | ||
|
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,4 +1,4 @@ | ||
use bevy::prelude::*; | ||
use crate::prelude::*; | ||
|
||
mod camera; | ||
mod music; | ||
|
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,5 +1,3 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::prelude::*; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
|
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,4 +1,4 @@ | ||
use bevy::{audio::PlaybackMode, prelude::*}; | ||
use bevy::audio::PlaybackMode; | ||
|
||
use crate::prelude::*; | ||
|
||
|
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 @@ | ||
/// Gets a single `Entity` from a `Query` or returns gracefully (no panic). | ||
#[macro_export] | ||
macro_rules! single { | ||
($q:expr, $r:expr) => { | ||
match $q.get_single() { | ||
Ok(m) => m, | ||
_ => { | ||
debug!("get single failed for ${}", stringify!($e)); | ||
$r | ||
}, | ||
} | ||
}; | ||
($q:expr) => { | ||
single!($q, return) | ||
}; | ||
} |
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,50 +1,28 @@ | ||
use bevy::prelude::*; | ||
|
||
// use crate::{prelude::*, ui::navigation::*}; | ||
use crate::prelude::*; | ||
|
||
mod navigation; | ||
mod widgets; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_plugins(navigation::plugin); | ||
// app.register_component_as::<dyn Navigable, MenuItem>() | ||
// .add_systems(OnEnter(GameState::Startup), init); | ||
app.add_plugins((navigation::plugin, widgets::plugin)); | ||
app.add_systems(OnEnter(GameState::Startup), init); | ||
} | ||
|
||
pub mod prelude { | ||
pub use bevy_trait_query::RegisterExt; | ||
|
||
pub use super::{ | ||
navigation::NavBundle, | ||
widgets::{Container, Stylable, Widget}, | ||
navigation::{NavBundle, NavContainer, Navigable}, | ||
widgets::{Container, NavigableExt, Stylable, Widget}, | ||
}; | ||
} | ||
|
||
// #[derive(Component)] | ||
// struct MenuItem { | ||
// label: String, | ||
// } | ||
// | ||
// impl Navigable for MenuItem { | ||
// fn label(&self) -> String { | ||
// self.label.clone() | ||
// } | ||
// | ||
// fn action(&self) { | ||
// info!("action {}", self.label()); | ||
// } | ||
// } | ||
// | ||
// fn init(mut cmd: Commands) { | ||
// let mut root = cmd.ui_root(); | ||
// root.with_children(|node| { | ||
// node.button("hey").insert(MenuItem { | ||
// label: "hey".into(), | ||
// }); | ||
// node.button("hi").insert(MenuItem { label: "hi".into() }); | ||
// node.button("hello").insert(MenuItem { | ||
// label: "hello".into(), | ||
// }); | ||
// }) | ||
// .insert(NavContainer::default()); | ||
// } | ||
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(); | ||
} |
Oops, something went wrong.