mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Moved events to ECS (#1823)
Fixes #1809. It makes it also possible to use `derive` for `SystemParam` inside ECS and avoid manual implementation. An alternative solution to macro changes is to use `use crate as bevy_ecs;` in `event.rs`.
This commit is contained in:
parent
01142a137e
commit
04a37f722a
11 changed files with 18 additions and 21 deletions
|
@ -1,11 +1,11 @@
|
|||
use crate::{
|
||||
app::{App, AppExit},
|
||||
event::Events,
|
||||
plugin::Plugin,
|
||||
CoreStage, PluginGroup, PluginGroupBuilder, StartupStage,
|
||||
};
|
||||
use bevy_ecs::{
|
||||
component::{Component, ComponentDescriptor},
|
||||
event::Events,
|
||||
schedule::{
|
||||
RunOnce, Schedule, Stage, StageLabel, State, SystemDescriptor, SystemSet, SystemStage,
|
||||
},
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
mod app;
|
||||
mod app_builder;
|
||||
mod event;
|
||||
mod plugin;
|
||||
mod plugin_group;
|
||||
mod schedule_runner;
|
||||
|
@ -8,17 +7,15 @@ mod schedule_runner;
|
|||
pub use app::*;
|
||||
pub use app_builder::*;
|
||||
pub use bevy_derive::DynamicPlugin;
|
||||
pub use event::*;
|
||||
pub use bevy_ecs::event::*;
|
||||
pub use plugin::*;
|
||||
pub use plugin_group::*;
|
||||
pub use schedule_runner::*;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
app::App,
|
||||
app_builder::AppBuilder,
|
||||
event::{EventReader, EventWriter},
|
||||
CoreStage, DynamicPlugin, Plugin, PluginGroup, StartupStage,
|
||||
app::App, app_builder::AppBuilder, CoreStage, DynamicPlugin, Plugin, PluginGroup,
|
||||
StartupStage,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use super::{App, AppBuilder};
|
||||
use crate::{app::AppExit, event::Events, plugin::Plugin, ManualEventReader};
|
||||
use crate::{app::AppExit, plugin::Plugin, ManualEventReader};
|
||||
use bevy_ecs::event::Events;
|
||||
use bevy_utils::{Duration, Instant};
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use bevy_ecs::{
|
||||
use crate as bevy_ecs;
|
||||
use crate::{
|
||||
component::Component,
|
||||
system::{Local, Res, ResMut, SystemParam},
|
||||
};
|
||||
|
@ -76,7 +77,7 @@ enum State {
|
|||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use bevy_app::Events;
|
||||
/// use bevy_ecs::event::Events;
|
||||
///
|
||||
/// struct MyEvent {
|
||||
/// value: usize
|
|
@ -2,6 +2,7 @@ pub mod archetype;
|
|||
pub mod bundle;
|
||||
pub mod component;
|
||||
pub mod entity;
|
||||
pub mod event;
|
||||
pub mod query;
|
||||
#[cfg(feature = "bevy_reflect")]
|
||||
pub mod reflect;
|
||||
|
@ -16,6 +17,7 @@ pub mod prelude {
|
|||
pub use crate::{
|
||||
bundle::Bundle,
|
||||
entity::Entity,
|
||||
event::{EventReader, EventWriter},
|
||||
query::{Added, ChangeTrackers, Changed, Or, QueryState, With, WithBundle, Without},
|
||||
schedule::{
|
||||
AmbiguitySetLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::{ElementState, Input};
|
||||
use bevy_app::prelude::EventReader;
|
||||
use bevy_ecs::system::ResMut;
|
||||
use bevy_ecs::{event::EventReader, system::ResMut};
|
||||
use bevy_math::Vec2;
|
||||
|
||||
/// A mouse button input event
|
||||
|
|
|
@ -2,10 +2,8 @@ use crate::{
|
|||
keyboard::{KeyCode, KeyboardInput},
|
||||
ElementState,
|
||||
};
|
||||
use bevy_app::{
|
||||
prelude::{EventReader, EventWriter},
|
||||
AppExit,
|
||||
};
|
||||
use bevy_app::AppExit;
|
||||
use bevy_ecs::prelude::{EventReader, EventWriter};
|
||||
|
||||
/// Sends the AppExit event whenever the "esc" key is pressed.
|
||||
pub fn exit_on_esc_system(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use super::CameraProjection;
|
||||
use bevy_app::prelude::EventReader;
|
||||
use bevy_ecs::{
|
||||
component::Component,
|
||||
entity::Entity,
|
||||
event::EventReader,
|
||||
query::Added,
|
||||
reflect::ReflectComponent,
|
||||
system::{Query, QuerySet, Res},
|
||||
|
|
|
@ -2,11 +2,11 @@ use crate::{
|
|||
pipeline::{IndexFormat, PrimitiveTopology, RenderPipelines, VertexFormat},
|
||||
renderer::{BufferInfo, BufferUsage, RenderResourceContext, RenderResourceId},
|
||||
};
|
||||
use bevy_app::prelude::EventReader;
|
||||
use bevy_asset::{AssetEvent, Assets, Handle};
|
||||
use bevy_core::AsBytes;
|
||||
use bevy_ecs::{
|
||||
entity::Entity,
|
||||
event::EventReader,
|
||||
query::{Changed, With},
|
||||
system::{Local, Query, QuerySet, Res},
|
||||
world::Mut,
|
||||
|
|
|
@ -5,9 +5,8 @@ use super::{
|
|||
use crate::renderer::{
|
||||
RenderResource, RenderResourceContext, RenderResourceId, RenderResourceType,
|
||||
};
|
||||
use bevy_app::prelude::EventReader;
|
||||
use bevy_asset::{AssetEvent, Assets, Handle};
|
||||
use bevy_ecs::system::Res;
|
||||
use bevy_ecs::{event::EventReader, system::Res};
|
||||
use bevy_reflect::TypeUuid;
|
||||
use bevy_utils::HashSet;
|
||||
use thiserror::Error;
|
||||
|
|
Loading…
Reference in a new issue