Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with bevy git #20

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "iyes_loopless"
version = "0.6.0"
version = "0.6.1"
description = "Composable alternatives to Bevy's States/FixedTimestep/RunCriteria"
edition = "2021"
license = "MIT OR Apache-2.0"
Expand All @@ -15,7 +15,7 @@ exclude = ["assets"]
[features]
default = [ "fixedtimestep", "states", "bevy-compat", "app" ]
fixedtimestep = [
"bevy_core",
"bevy_time",
]
states = [
"bevy_utils",
Expand All @@ -28,11 +28,11 @@ app = [
]

[dependencies]
bevy_ecs = "0.7.0"
bevy_app = { version = "0.7.0", optional = true }
bevy_core = { version = "0.7.0", optional = true }
bevy_utils = { version = "0.7.0", optional = true }
bevy_ecs = { git = "https://github.com/bevyengine/bevy" }
bevy_app = { git = "https://github.com/bevyengine/bevy", optional = true }
bevy_time = { git = "https://github.com/bevyengine/bevy", optional = true }
bevy_utils = { git = "https://github.com/bevyengine/bevy", optional = true }

[dev-dependencies]
bevy = "0.7.0"
bevy = { git = "https://github.com/bevyengine/bevy" }
rand = "0.8.5"
2 changes: 1 addition & 1 deletion examples/fixedtimestep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ fn reposition_entities(mut q: Query<&mut Transform, With<MySprite>>) {
}

fn setup_camera(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d());
commands.spawn_bundle(Camera2dBundle::default());
}
26 changes: 10 additions & 16 deletions examples/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use bevy::prelude::*;
use iyes_loopless::prelude::*;

use bevy::app::AppExit;
use bevy::input::system::exit_on_esc_system;
use bevy::window::close_on_esc;

use std::time::Duration;

Expand Down Expand Up @@ -49,16 +49,13 @@ fn main() {
.add_enter_system(GameState::MainMenu, setup_menu)
// menu cleanup (state exit) systems
.add_exit_system(GameState::MainMenu, despawn_with::<MainMenu>)
// game setup (state enter) systems
.add_enter_system(GameState::InGame, setup_game_camera)
// game cleanup (state exit) systems
.add_exit_system(GameState::InGame, despawn_with::<MySprite>)
.add_exit_system(GameState::InGame, despawn_with::<GameCamera>)
// menu stuff
.add_system_set(
ConditionSet::new()
.run_in_state(GameState::MainMenu)
.with_system(exit_on_esc_system)
.with_system(close_on_esc)
.with_system(butt_interact_visual)
// our menu button handlers
.with_system(butt_exit.run_if(on_butt_interact::<ExitButt>))
Expand All @@ -76,8 +73,8 @@ fn main() {
)
// our other various systems:
.add_system(debug_current_state)
// setup our UI camera globally at startup and keep it alive at all times
.add_startup_system(setup_ui_camera)
// setup our camera globally at startup and keep it alive at all times
.add_startup_system(setup_camera)
.run();
}

Expand Down Expand Up @@ -154,14 +151,11 @@ fn spawn_sprite(mut commands: Commands) {
.insert(MySprite);
}

/// Spawn the UI camera
fn setup_ui_camera(mut commands: Commands) {
commands.spawn_bundle(UiCameraBundle::default());
}


/// Spawn the game camera
fn setup_game_camera(mut commands: Commands) {
commands.spawn_bundle(OrthographicCameraBundle::new_2d())
fn setup_camera(mut commands: Commands) {
commands.spawn_bundle(Camera2dBundle::default())
.insert(GameCamera);
}

Expand Down Expand Up @@ -222,8 +216,8 @@ fn setup_menu(mut commands: Commands, ass: Res<AssetServer>) {
let butt_style = Style {
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
padding: Rect::all(Val::Px(8.0)),
margin: Rect::all(Val::Px(4.0)),
padding: UiRect::all(Val::Px(8.0)),
margin: UiRect::all(Val::Px(4.0)),
flex_grow: 1.0,
..Default::default()
};
Expand All @@ -238,7 +232,7 @@ fn setup_menu(mut commands: Commands, ass: Res<AssetServer>) {
color: UiColor(Color::rgb(0.5, 0.5, 0.5)),
style: Style {
size: Size::new(Val::Auto, Val::Auto),
margin: Rect::all(Val::Auto),
margin: UiRect::all(Val::Auto),
align_self: AlignSelf::Center,
flex_direction: FlexDirection::ColumnReverse,
//align_items: AlignItems::Stretch,
Expand Down
4 changes: 2 additions & 2 deletions src/condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,12 @@ impl ConditionSet {
}

pub fn before<Marker>(mut self, label: impl AsSystemLabel<Marker> + 'static) -> Self {
self.labellers.push(Box::new(move |set: SystemSet| set.before(label.as_system_label())));
self.labellers.push(Box::new(move |set: SystemSet| set.before(label)));
self
}

pub fn after<Marker>(mut self, label: impl AsSystemLabel<Marker> + 'static) -> Self {
self.labellers.push(Box::new(move |set: SystemSet| set.after(label.as_system_label())));
self.labellers.push(Box::new(move |set: SystemSet| set.after(label)));
self
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fixedtimestep.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::time::Duration;

use bevy_core::Time;
use bevy_ecs::prelude::*;
use bevy_time::Time;

/// This type will be available as a resource, while a fixed timestep stage
/// runs, to provide info about the current status of the fixed timestep.
Expand Down
1 change: 1 addition & 0 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ pub mod app {
use super::StateTransitionStage;

#[derive(Debug, Clone, PartialEq, Eq, Hash, StageLabel)]
#[stage_label(ignore_fields)]
pub struct StateTransitionStageLabel(TypeId, String);

impl StateTransitionStageLabel {
Expand Down