Skip to content

Commit

Permalink
patch
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Jul 4, 2024
1 parent 3719969 commit 6aae75c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions crates/beet_core/src/movement/movement_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl Plugin for MovementPlugin {
registry.register::<Force>();
registry.register::<RotateToVelocity2d>();
registry.register::<RotateToVelocity3d>();
registry.register::<VelocityScalar>();

drop(registry);

Expand Down
2 changes: 1 addition & 1 deletion crates/beet_examples/examples/build_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() -> Result<()> {
SceneItem::new_bundle("camera-2d", BundlePlaceholder::Camera2d),
SceneItem::new_bundle("camera-3d", BundlePlaceholder::Camera3d),
SceneItem::new_resource("beet-debug", BeetDebugConfig::default()),
SceneItem::new("space-background", scenes::space_background),
SceneItem::new("space-scene", scenes::space_scene),
SceneItem::new("ui-terminal", spawn_ui_terminal),
SceneItem::new("seek", scenes::seek),
SceneItem::new("flock", scenes::flock),
Expand Down
4 changes: 3 additions & 1 deletion crates/beet_examples/examples/scenes/setup_2d.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use beet_examples::prelude::*;
use bevy::prelude::*;

pub fn space_background(mut commands: Commands) {
pub fn space_scene(mut commands: Commands) {
commands.insert_resource(WrapAround::default());

commands.spawn((
AssetLoadBlockAppReady,
Transform::from_translation(Vec3::new(0., 0., -1.))
Expand Down
1 change: 0 additions & 1 deletion crates/beet_examples/src/plugins/example_plugin_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl Plugin for Example2dPlugin {
.run_if(|res: Option<Res<WrapAround>>| res.is_some())
.in_set(PostTickSet),
)
// .insert_resource(WrapAround::default())
.register_type::<AutoSpawn>()
.register_type::<RandomizePosition>()
.register_type::<RenderText>()
Expand Down
15 changes: 13 additions & 2 deletions crates/beet_examples/src/serde_utils/bundle_placeholder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub enum BundlePlaceholder {
Camera2d,
Camera3d,
Sprite(String),
Scene(String),
}

#[derive(Debug, Default)]
Expand All @@ -23,9 +24,12 @@ impl Plugin for BundlePlaceholderPlugin {
fn init_bundle(
asset_server: Res<AssetServer>,
mut commands: Commands,
query: Query<(Entity,Option<&Transform>, &BundlePlaceholder), Added<BundlePlaceholder>>,
query: Query<
(Entity, Option<&Transform>, &BundlePlaceholder),
Added<BundlePlaceholder>,
>,
) {
for (entity,transform, placeholder) in query.iter() {
for (entity, transform, placeholder) in query.iter() {
let mut entity_commands = commands.entity(entity);
entity_commands.remove::<BundlePlaceholder>();
let transform = transform.cloned().unwrap_or_default();
Expand All @@ -50,6 +54,13 @@ fn init_bundle(
..default()
});
}
BundlePlaceholder::Scene(path) => {
entity_commands.insert(SceneBundle {
scene: asset_server.load(path),
transform,
..default()
});
}
}
}
}
3 changes: 2 additions & 1 deletion examples/default_beet_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
//! Common combinations:
//! - hello world: `beet-debug camera-2d ui-terminal hello-world`
//! - hello_llm: `beet-debug camera-2d ui-terminal sentence-selector`
//! - seek: `beet-debug camera-2d space-background seek`
//! - seek: `beet-debug camera-2d space-scene seek`
//! - flocking: `beet-debug camera-2d space-scene flock`
//!
//!
use anyhow::Result;
Expand Down

0 comments on commit 6aae75c

Please sign in to comment.