diff --git a/Cargo.lock b/Cargo.lock index 33f2581..303fd45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -640,19 +640,6 @@ dependencies = [ "syn 2.0.72", ] -[[package]] -name = "bevy_embedded_assets" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3f3e7b41a9b01b767ba07c4ebb083b2d8d8055e57ddef7e55e502bbfc961505" -dependencies = [ - "bevy", - "cargo-emit", - "futures-io", - "futures-lite", - "thiserror", -] - [[package]] name = "bevy_encase_derive" version = "0.14.0" @@ -1442,12 +1429,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cargo-emit" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1582e1c9e755dd6ad6b224dcffb135d199399a4568d454bd89fe515ca8425695" - [[package]] name = "cassowary" version = "0.3.0" @@ -2749,11 +2730,10 @@ dependencies = [ [[package]] name = "lifecycler" -version = "0.2.0" +version = "0.2.1" dependencies = [ "bevy", "bevy_atmosphere", - "bevy_embedded_assets", "bevy_hanabi", "bevy_ratatui", "bevy_ratatui_render", diff --git a/Cargo.toml b/Cargo.toml index 440db2b..535901f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lifecycler" description = "Bevy Game Jam #5 submission. Terminal aquarium." -version = "0.2.1" +version = "0.2.2" edition = "2021" license = "MIT OR Apache-2.0 OR CC0-1.0" authors = ["cxreiff "] @@ -14,7 +14,6 @@ include = ["/src", "/assets"] [dependencies] bevy = "0.14.0" bevy_atmosphere = "0.10.0" -bevy_embedded_assets = "0.11.0" bevy_hanabi = "0.12.0" bevy_ratatui = "0.6.1" bevy_ratatui_render = "0.5.2" diff --git a/src/assets.rs b/src/assets.rs new file mode 100644 index 0000000..f731f59 --- /dev/null +++ b/src/assets.rs @@ -0,0 +1,19 @@ +use bevy::asset::embedded_asset; +use bevy::prelude::*; + +pub(super) fn plugin(app: &mut App) { + let prefix = "src/"; + embedded_asset!(app, prefix, "../assets/base.glb"); + embedded_asset!(app, prefix, "../assets/bubble.ogg"); + embedded_asset!(app, prefix, "../assets/coral.glb"); + embedded_asset!(app, prefix, "../assets/fish.glb"); + embedded_asset!(app, prefix, "../assets/frame.glb"); + embedded_asset!(app, prefix, "../assets/gravel.glb"); + embedded_asset!(app, prefix, "../assets/off.ogg"); + embedded_asset!(app, prefix, "../assets/on.ogg"); + embedded_asset!(app, prefix, "../assets/rocks.glb"); + embedded_asset!(app, prefix, "../assets/skeleton.glb"); + embedded_asset!(app, prefix, "../assets/snail.glb"); + embedded_asset!(app, prefix, "../assets/starfish.glb"); + embedded_asset!(app, prefix, "../assets/tank.glb"); +} diff --git a/src/camera.rs b/src/camera.rs index 5a6b539..8881479 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -62,8 +62,12 @@ fn setup_camera_system(mut commands: Commands, ratatui_render: Res) { - commands.insert_resource(ClickOnSound(asset_server.load("on.ogg"))); - commands.insert_resource(ClickOffSound(asset_server.load("off.ogg"))); + commands.insert_resource(ClickOnSound( + asset_server.load("embedded://lifecycler/../assets/on.ogg"), + )); + commands.insert_resource(ClickOffSound( + asset_server.load("embedded://lifecycler/../assets/off.ogg"), + )); } fn toggle_daylight_system( diff --git a/src/creatures/fish_systems.rs b/src/creatures/fish_systems.rs index 7417371..bd59cd4 100644 --- a/src/creatures/fish_systems.rs +++ b/src/creatures/fish_systems.rs @@ -52,7 +52,7 @@ fn setup_fish_system( mesh: 0, primitive: 0, }) - .from_asset("embedded://fish.glb"), + .from_asset("embedded://lifecycler/../assets/fish.glb"), ); commands.insert_resource(FishMesh(fish_mesh)); diff --git a/src/creatures/lifecycle.rs b/src/creatures/lifecycle.rs index 765f971..0a0aadd 100644 --- a/src/creatures/lifecycle.rs +++ b/src/creatures/lifecycle.rs @@ -45,7 +45,9 @@ pub struct FishSkeletonBundle(SceneBundle); fn setup_lifecycle_system(mut commands: Commands, asset_server: Res) { let fish_skeleton = SceneBundle { - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://skeleton.glb")), + scene: asset_server.load( + GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/skeleton.glb"), + ), ..default() }; commands.insert_resource(FishSkeletonBundle(fish_skeleton)); diff --git a/src/creatures/snail_systems.rs b/src/creatures/snail_systems.rs index cff8b3a..0524843 100644 --- a/src/creatures/snail_systems.rs +++ b/src/creatures/snail_systems.rs @@ -37,7 +37,8 @@ fn setup_snails_system( asset_server: Res, mut spawn_events: EventWriter, ) { - let snail = asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://snail.glb")); + let snail = asset_server + .load(GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/snail.glb")); commands.insert_resource(SnailScene(snail)); spawn_events.send(SnailSpawnEvent(Vec3::new(-1.4, -1.7, 0.4), 0.1)); diff --git a/src/creatures/starfish_systems.rs b/src/creatures/starfish_systems.rs index 3076d5a..8406b42 100644 --- a/src/creatures/starfish_systems.rs +++ b/src/creatures/starfish_systems.rs @@ -36,8 +36,8 @@ fn setup_starfishes_system( asset_server: Res, mut spawn_events: EventWriter, ) { - let starfish = - asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://starfish.glb")); + let starfish = asset_server + .load(GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/starfish.glb")); commands.insert_resource(StarfishScene(starfish)); spawn_events.send(StarfishSpawnEvent(Vec3::new(-0.3, -1.3, -0.4), 0.2)); diff --git a/src/lib.rs b/src/lib.rs index 70a81b9..2e517f6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,11 +5,11 @@ use bevy::{ window::ExitCondition, }; use bevy_atmosphere::plugin::AtmospherePlugin; -use bevy_embedded_assets::EmbeddedAssetPlugin; use bevy_hanabi::HanabiPlugin; use bevy_ratatui::RatatuiPlugins; use bevy_ratatui_render::RatatuiRenderPlugin; +mod assets; mod bubbles; mod camera; mod creatures; @@ -35,7 +35,6 @@ impl Plugin for AppPlugin { level: bevy::log::Level::ERROR, ..default() }), - EmbeddedAssetPlugin::default(), ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1. / 90.)), FrameTimeDiagnosticsPlugin, RatatuiPlugins { @@ -50,6 +49,7 @@ impl Plugin for AppPlugin { .init_resource::(); app.add_plugins(( + assets::plugin, bubbles::plugin, camera::plugin, draw::plugin, diff --git a/src/pellets.rs b/src/pellets.rs index 122a8bd..1d78e30 100644 --- a/src/pellets.rs +++ b/src/pellets.rs @@ -74,7 +74,9 @@ fn setup_pellets_system( } fn setup_sfx_system(mut commands: Commands, asset_server: Res) { - commands.insert_resource(PelletSound(asset_server.load("bubble.ogg"))); + commands.insert_resource(PelletSound( + asset_server.load("embedded://lifecycler/../assets/bubble.ogg"), + )); } fn create_pellets_system( diff --git a/src/tank.rs b/src/tank.rs index 9f540b8..228a205 100644 --- a/src/tank.rs +++ b/src/tank.rs @@ -19,14 +19,18 @@ fn setup_tank_system( SceneBundle { transform: Transform::from_scale(Vec3::new(2., 0.5, 2.)) .with_rotation(Quat::from_rotation_x(PI / 2.)), - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://tank.glb")), + scene: asset_server.load( + GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/tank.glb"), + ), ..default() }, )); commands.spawn(SceneBundle { transform: Transform::from_scale(Vec3::new(1.8, 1., 0.5)) .with_translation(Vec3::new(0., -1.75, 0.)), - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://gravel.glb")), + scene: asset_server.load( + GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/gravel.glb"), + ), ..default() }); @@ -34,7 +38,8 @@ fn setup_tank_system( transform: Transform::from_scale(Vec3::new(2., 0.6, 2.0)) .with_translation(Vec3::new(0., 0.0, 0.)) .with_rotation(Quat::from_rotation_x(PI / 2.)), - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://base.glb")), + scene: asset_server + .load(GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/base.glb")), ..default() }); @@ -42,7 +47,8 @@ fn setup_tank_system( transform: Transform::from_scale(Vec3::new(2., 2., 0.6)) .with_translation(Vec3::new(0., 0.0, 0.)) .with_rotation(Quat::from_rotation_x(0.)), - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://frame.glb")), + scene: asset_server + .load(GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/frame.glb")), ..default() }); @@ -68,7 +74,7 @@ fn setup_tank_system( mesh: 0, primitive: 0, }) - .from_asset("embedded://coral.glb"), + .from_asset("embedded://lifecycler/../assets/coral.glb"), ); commands.spawn(coral_bundle_1); @@ -82,12 +88,13 @@ fn setup_tank_system( mesh: 1, primitive: 0, }) - .from_asset("embedded://coral.glb"), + .from_asset("embedded://lifecycler/../assets/coral.glb"), ); commands.spawn(coral_bundle_2); let rock_bundle = SceneBundle { - scene: asset_server.load(GltfAssetLabel::Scene(0).from_asset("embedded://rocks.glb")), + scene: asset_server + .load(GltfAssetLabel::Scene(0).from_asset("embedded://lifecycler/../assets/rocks.glb")), ..default() };