-
Notifications
You must be signed in to change notification settings - Fork 0
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
5 changed files
with
75 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use bevy::prelude::*; | ||
use bevy_asset_loader::prelude::*; | ||
|
||
use crate::screens::Screen; | ||
|
||
pub fn plugin(app: &mut App) { | ||
app.add_loading_state(LoadingState::new(Screen::Loading).continue_to_state(Screen::Title)); | ||
} | ||
|
||
#[derive(AssetCollection, Resource)] | ||
pub struct Textures {} |
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,3 +1,21 @@ | ||
mod loading; | ||
mod title; | ||
|
||
use bevy::prelude::*; | ||
|
||
pub fn plugin(mut app: &mut App) {} | ||
pub fn plugin(app: &mut App) { | ||
app.init_state::<Screen>(); | ||
app.enable_state_scoped_entities::<Screen>(); | ||
|
||
app.add_plugins((loading::plugin, title::plugin)); | ||
} | ||
|
||
#[derive(States, Debug, Hash, PartialEq, Eq, Clone, Default)] | ||
pub enum Screen { | ||
#[default] | ||
Loading, | ||
// Over, | ||
// Playing, | ||
// Splash, | ||
Title, | ||
} |
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,3 @@ | ||
use bevy::prelude::*; | ||
|
||
pub 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use bevy::prelude::*; | ||
|
||
use crate::screens::Screen; | ||
|
||
pub(super) fn plugin(app: &mut App) { | ||
app.add_systems(OnEnter(Screen::Title), spawn_title_screen); | ||
} | ||
|
||
fn spawn_title_screen(mut commands: Commands) { | ||
commands | ||
.spawn((StateScoped(Screen::Title), Name::new("Title"), Node { | ||
align_items: AlignItems::Center, | ||
flex_direction: FlexDirection::Column, | ||
height: Val::Percent(100.), | ||
justify_content: JustifyContent::Start, | ||
justify_self: JustifySelf::Center, | ||
padding: UiRect::all(Val::Px(10.)), | ||
width: Val::Percent(100.), | ||
..default() | ||
})) | ||
.with_children(|p| { | ||
p.spawn((Text::new("All The Way Home"), TextFont { | ||
font_size: 30., | ||
..default() | ||
})); | ||
}); | ||
} | ||
|
||
// fn enter_gameplay_screen(_trigger: Trigger<OnPress>, mut next_screen: ResMut<NextState<Screen>>) { | ||
// next_screen.set(Screen::Playing); | ||
// } | ||
// | ||
// fn enter_credits_screen(_trigger: Trigger<OnPress>, mut next_screen: ResMut<NextState<Screen>>) { | ||
// next_screen.set(Screen::Credits); | ||
// } | ||
// | ||
// #[cfg(not(target_family = "wasm"))] | ||
// fn exit_app(_trigger: Trigger<OnPress>, mut app_exit: EventWriter<AppExit>) { | ||
// app_exit.send(AppExit::Success); | ||
// } |