cargo fmt
This commit is contained in:
parent
1db77b2435
commit
196bde64e3
@ -1,5 +1,5 @@
|
||||
use super::AppBuilder;
|
||||
use bevy_ecs::{Resources, Schedule, World, ParallelExecutor};
|
||||
use bevy_ecs::{ParallelExecutor, Resources, Schedule, World};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct App {
|
||||
@ -19,12 +19,17 @@ impl App {
|
||||
|
||||
pub fn update(&mut self) {
|
||||
self.schedule.initialize(&mut self.resources);
|
||||
self.executor.run(&mut self.schedule, &mut self.world, &mut self.resources);
|
||||
self.executor
|
||||
.run(&mut self.schedule, &mut self.world, &mut self.resources);
|
||||
}
|
||||
|
||||
pub fn run(mut self) {
|
||||
self.startup_schedule.initialize(&mut self.resources);
|
||||
self.startup_executor.run(&mut self.startup_schedule, &mut self.world, &mut self.resources);
|
||||
self.startup_executor.run(
|
||||
&mut self.startup_schedule,
|
||||
&mut self.world,
|
||||
&mut self.resources,
|
||||
);
|
||||
if let Some(run) = self.runner.take() {
|
||||
run(self)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use bevy_asset::AssetLoader;
|
||||
use std::{sync::Arc, path::Path};
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AudioSource {
|
||||
@ -18,7 +18,9 @@ pub struct Mp3Loader;
|
||||
|
||||
impl AssetLoader<AudioSource> for Mp3Loader {
|
||||
fn from_bytes(&self, _asset_path: &Path, bytes: Vec<u8>) -> Result<AudioSource> {
|
||||
Ok(AudioSource { bytes: Arc::new(bytes) })
|
||||
Ok(AudioSource {
|
||||
bytes: Arc::new(bytes),
|
||||
})
|
||||
}
|
||||
fn extensions(&self) -> &[&str] {
|
||||
static EXTENSIONS: &[&str] = &["mp3"];
|
||||
|
@ -4,9 +4,9 @@ pub mod time;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_math::{Mat3, Mat4, Quat, Vec2, Vec3};
|
||||
use bevy_type_registry::RegisterType;
|
||||
use time::{time_system, timer_system, Time, Timer};
|
||||
use bevy_math::{Vec3, Vec2, Mat3, Mat4, Quat};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct CorePlugin;
|
||||
|
@ -47,7 +47,7 @@ pub fn get_modules(attributes: &[Attribute]) -> Modules {
|
||||
if attribute.path.get_ident().as_ref().unwrap().to_string() == AS_CRATE_ATTRIBUTE_NAME {
|
||||
let value = attribute.tokens.to_string();
|
||||
if &value[1..value.len() - 1] == modules.bevy_render {
|
||||
modules.bevy_render = "crate".to_string();
|
||||
modules.bevy_render = "crate".to_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ where
|
||||
fn archetype_access(&self) -> &ArchetypeAccess {
|
||||
&self.archetype_access
|
||||
}
|
||||
|
||||
|
||||
fn resource_access(&self) -> &TypeAccess {
|
||||
&self.resource_access
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
pub use hecs::{Query as HecsQuery, *};
|
||||
|
||||
mod commands;
|
||||
mod parallel_executor;
|
||||
mod into_system;
|
||||
mod parallel_executor;
|
||||
#[cfg(feature = "profiler")]
|
||||
pub mod profiler;
|
||||
pub mod resource_query;
|
||||
@ -13,9 +13,9 @@ mod world_builder;
|
||||
|
||||
pub use commands::{Commands, CommandsInternal};
|
||||
pub use into_system::{IntoForEachSystem, IntoQuerySystem, IntoThreadLocalSystem, Query};
|
||||
pub use parallel_executor::ParallelExecutor;
|
||||
pub use resource_query::{FetchResource, Local, Res, ResMut, ResourceQuery};
|
||||
pub use resources::{FromResources, Resource, Resources};
|
||||
pub use schedule::Schedule;
|
||||
pub use parallel_executor::ParallelExecutor;
|
||||
pub use system::{System, SystemId, TypeAccess, ArchetypeAccess};
|
||||
pub use system::{ArchetypeAccess, System, SystemId, TypeAccess};
|
||||
pub use world_builder::{WorldBuilder, WorldBuilderSource};
|
||||
|
@ -29,7 +29,8 @@ impl ParallelExecutor {
|
||||
|
||||
if schedule_changed {
|
||||
self.stages.clear();
|
||||
self.stages.resize_with(schedule.stage_order.len(), || ExecutorStage::default());
|
||||
self.stages
|
||||
.resize_with(schedule.stage_order.len(), || ExecutorStage::default());
|
||||
}
|
||||
|
||||
for (stage_index, stage_name) in schedule.stage_order.iter().enumerate() {
|
||||
|
@ -1,4 +1,8 @@
|
||||
use crate::{resources::FromResources, system::{TypeAccess, SystemId}, Archetype, Component, Resources};
|
||||
use crate::{
|
||||
resources::FromResources,
|
||||
system::{SystemId, TypeAccess},
|
||||
Archetype, Component, Resources,
|
||||
};
|
||||
use core::{
|
||||
any::TypeId,
|
||||
ops::{Deref, DerefMut},
|
||||
|
@ -4,7 +4,8 @@ use crate::{
|
||||
};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::{HashMap, HashSet}, sync::{Mutex, Arc},
|
||||
collections::{HashMap, HashSet},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
@ -151,4 +152,4 @@ impl Schedule {
|
||||
pub fn generation(&self) -> usize {
|
||||
self.generation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,9 +99,9 @@ impl TypeAccess {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{TypeAccess, ArchetypeAccess};
|
||||
use super::{ArchetypeAccess, TypeAccess};
|
||||
use crate::{FetchResource, Res, ResMut, ResourceQuery};
|
||||
use hecs::World;
|
||||
use crate::{ResourceQuery, FetchResource, Res, ResMut};
|
||||
use std::any::TypeId;
|
||||
|
||||
struct A;
|
||||
@ -136,7 +136,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn resource_query_access() {
|
||||
let access = <<(Res<A>, ResMut<B>, Res<C>) as ResourceQuery>::Fetch as FetchResource>::access();
|
||||
let access =
|
||||
<<(Res<A>, ResMut<B>, Res<C>) as ResourceQuery>::Fetch as FetchResource>::access();
|
||||
let mut expected_access = TypeAccess::default();
|
||||
expected_access.immutable.insert(TypeId::of::<A>());
|
||||
expected_access.immutable.insert(TypeId::of::<C>());
|
||||
|
@ -1,4 +1,4 @@
|
||||
mod face_toward;
|
||||
|
||||
pub use face_toward::*;
|
||||
pub use glam::*;
|
||||
pub use glam::*;
|
||||
|
@ -1,8 +1,8 @@
|
||||
use bevy_core::bytes::Byteable;
|
||||
use bevy_math::Mat4;
|
||||
use bevy_property::Properties;
|
||||
use bevy_render::{CameraProjection, Color, PerspectiveProjection};
|
||||
use bevy_transform::components::Translation;
|
||||
use bevy_math::Mat4;
|
||||
use std::ops::Range;
|
||||
|
||||
#[derive(Properties)]
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::CameraProjection;
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_ecs::{Component, Local, Query, Res};
|
||||
use bevy_math::Mat4;
|
||||
use bevy_property::Properties;
|
||||
use bevy_window::{WindowCreated, WindowReference, WindowResized, Windows};
|
||||
use bevy_math::Mat4;
|
||||
|
||||
#[derive(Default, Debug, Properties)]
|
||||
pub struct Camera {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy_property::{Properties, Property};
|
||||
use bevy_math::Mat4;
|
||||
use bevy_property::{Properties, Property};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub trait CameraProjection {
|
||||
|
@ -5,8 +5,8 @@ use crate::{
|
||||
};
|
||||
use bevy_asset::Handle;
|
||||
use bevy_core::bytes::{Byteable, Bytes};
|
||||
use bevy_property::Property;
|
||||
use bevy_math::Vec4;
|
||||
use bevy_property::Property;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::ops::{Add, AddAssign};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{Rect, TextureAtlas};
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_render::texture::Texture;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::texture::Texture;
|
||||
use guillotiere::{size2, AllocId, Allocation, AtlasAllocator};
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
@ -19,12 +19,12 @@ pub use texture_atlas_builder::*;
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_asset::{AddAsset, Assets, Handle};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::{
|
||||
mesh::{shape, Mesh},
|
||||
render_graph::RenderGraph,
|
||||
shader::asset_shader_defs_system,
|
||||
};
|
||||
use bevy_math::Vec2;
|
||||
use sprite::sprite_system;
|
||||
|
||||
#[derive(Default)]
|
||||
|
@ -2,11 +2,11 @@ use crate::ColorMaterial;
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_core::bytes::Byteable;
|
||||
use bevy_ecs::{Query, Res};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::{
|
||||
render_resource::{RenderResource, RenderResources},
|
||||
texture::Texture,
|
||||
};
|
||||
use bevy_math::Vec2;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Default, RenderResources, RenderResource)]
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::Rect;
|
||||
use bevy_asset::Handle;
|
||||
use bevy_core::bytes::Bytes;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::{
|
||||
render_resource::{RenderResource, RenderResources},
|
||||
texture::Texture,
|
||||
Color,
|
||||
};
|
||||
use bevy_math::Vec2;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(RenderResources)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{Rect, TextureAtlas};
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_render::texture::Texture;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::texture::Texture;
|
||||
use rectangle_pack::{
|
||||
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
|
||||
RectToInsert, TargetBin,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use crate::{Font, FontAtlasSet};
|
||||
use ab_glyph::{Glyph, PxScale, ScaleFont};
|
||||
use bevy_asset::Assets;
|
||||
use bevy_math::{Mat4, Vec3};
|
||||
use bevy_render::{
|
||||
draw::{Draw, DrawContext, DrawError, Drawable},
|
||||
mesh,
|
||||
@ -12,7 +13,6 @@ use bevy_render::{
|
||||
Color,
|
||||
};
|
||||
use bevy_sprite::{TextureAtlas, TextureAtlasSprite};
|
||||
use bevy_math::{Mat4, Vec3};
|
||||
|
||||
pub struct TextStyle {
|
||||
pub font_size: f32,
|
||||
|
@ -1,6 +1,6 @@
|
||||
use ab_glyph::{FontVec, Glyph, InvalidFont, OutlinedGlyph, Point, PxScale, ScaleFont};
|
||||
use bevy_render::{texture::Texture, Color};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::{texture::Texture, Color};
|
||||
|
||||
pub struct Font {
|
||||
pub font: FontVec,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::texture::Texture;
|
||||
use bevy_sprite::{DynamicTextureAtlasBuilder, TextureAtlas};
|
||||
use bevy_math::Vec2;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub struct FontAtlas {
|
||||
|
@ -2,9 +2,9 @@ use crate::{Font, FontAtlas};
|
||||
use ab_glyph::ScaleFont;
|
||||
use bevy_asset::{Assets, Handle};
|
||||
use bevy_core::float_ord::FloatOrd;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_render::texture::Texture;
|
||||
use bevy_sprite::TextureAtlas;
|
||||
use bevy_math::Vec2;
|
||||
use std::collections::HashMap;
|
||||
|
||||
// work around rust's f32 order/hash limitations
|
||||
|
@ -6,4 +6,4 @@ mod world_child_builder;
|
||||
pub use child_builder::*;
|
||||
pub use hierarchy::*;
|
||||
pub use hierarchy_maintenance_system::*;
|
||||
pub use world_child_builder::*;
|
||||
pub use world_child_builder::*;
|
||||
|
@ -2,7 +2,7 @@
|
||||
use crate::components::*;
|
||||
|
||||
use bevy_ecs::{IntoQuerySystem, Query, System, Without};
|
||||
use bevy_math::{Vec3, Mat4, Quat};
|
||||
use bevy_math::{Mat4, Quat, Vec3};
|
||||
|
||||
// TODO: "on changed" for all of these systems
|
||||
pub fn local_transform_translation_system(
|
||||
@ -178,8 +178,8 @@ pub fn local_transform_systems() -> Vec<Box<dyn System>> {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use bevy_math::{Mat4, Quat, Vec3};
|
||||
use bevy_ecs::{Resources, Schedule, World};
|
||||
use bevy_math::{Mat4, Quat, Vec3};
|
||||
|
||||
#[test]
|
||||
fn correct_local_transformation() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{Anchors, Margins};
|
||||
use bevy_math::{Vec2, Vec3};
|
||||
use bevy_render::render_resource::RenderResources;
|
||||
use bevy_transform::prelude::Translation;
|
||||
use bevy_math::{Vec2, Vec3};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
enum MarginGrowDirection {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use super::Node;
|
||||
use bevy_ecs::{Entity, Query, Res, Without};
|
||||
use bevy_math::Vec2;
|
||||
use bevy_transform::{
|
||||
hierarchy,
|
||||
prelude::{Children, Parent, Translation},
|
||||
};
|
||||
use bevy_window::Windows;
|
||||
use bevy_math::Vec2;
|
||||
|
||||
pub const UI_Z_STEP: f32 = 0.001;
|
||||
|
||||
|
@ -10,7 +10,7 @@ pub use wgpu_renderer::*;
|
||||
pub use wgpu_resources::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_ecs::{IntoQuerySystem, Resources, IntoThreadLocalSystem, World};
|
||||
use bevy_ecs::{IntoQuerySystem, IntoThreadLocalSystem, Resources, World};
|
||||
use bevy_render::{
|
||||
render_resource::{free_shared_buffers_system, SharedBuffers},
|
||||
renderer::RenderResourceContext,
|
||||
|
@ -9,10 +9,10 @@ use bevy_input::{
|
||||
|
||||
use bevy_app::{App, AppBuilder, AppExit, AppPlugin, EventReader, Events};
|
||||
use bevy_ecs::Resources;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_window::{
|
||||
CreateWindow, CursorMoved, Window, WindowCloseRequested, WindowCreated, WindowResized, Windows,
|
||||
};
|
||||
use bevy_math::Vec2;
|
||||
use winit::{
|
||||
event,
|
||||
event::{DeviceEvent, WindowEvent},
|
||||
|
@ -5,9 +5,7 @@ pub use crate::{
|
||||
},
|
||||
asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle},
|
||||
audio::{AudioOutput, AudioSource},
|
||||
core::{
|
||||
time::{Time, Timer},
|
||||
},
|
||||
core::time::{Time, Timer},
|
||||
diagnostic::DiagnosticsPlugin,
|
||||
ecs::{
|
||||
Bundle, Commands, Component, Entity, FromResources, IntoForEachSystem, IntoQuerySystem,
|
||||
@ -15,7 +13,7 @@ pub use crate::{
|
||||
World, WorldBuilderSource,
|
||||
},
|
||||
input::{keyboard::KeyCode, mouse::MouseButton, Input},
|
||||
math::{self, Mat3, Mat4, Quat, Vec2, Vec3, Vec4, FaceToward},
|
||||
math::{self, FaceToward, Mat3, Mat4, Quat, Vec2, Vec3, Vec4},
|
||||
pbr::{entity::*, light::Light, material::StandardMaterial},
|
||||
property::{DynamicProperties, Properties, PropertiesVal, Property, PropertyVal},
|
||||
render::{
|
||||
|
Loading…
Reference in New Issue
Block a user