Skip to content

Commit de78d4c

Browse files
committed
Moozic
1 parent 5eba058 commit de78d4c

File tree

7 files changed

+73
-1
lines changed

7 files changed

+73
-1
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"rust-analyzer.showUnlinkedFileNotification": false
3+
}

Cargo.lock

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
license = "MIT OR Apache-2.0"
66

77
[dependencies]
8-
bevy = "0.10"
8+
bevy = {version="0.10", features=["mp3"]}
99
bevy_editor_pls = { version = "0.4.0", features = ["highlight_changes"], optional = true }
1010
bevy_replicon = "0.2.2"
1111
clap = { version = "4.2.1", features = ["derive"] }
@@ -20,6 +20,7 @@ bevy_egui = "0.20"
2020
egui = "0.21"
2121
bevy-inspector-egui = "0.18"
2222
futures-lite = "1.12.0"
23+
2324
# Enable a small amount of optimization in debug mode
2425
[profile.dev]
2526
opt-level = 1

assets/.keep

Whitespace-only changes.

assets/stellar_squeezebox.mp3

5.86 MB
Binary file not shown.

src/audio.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use bevy::prelude::*;
2+
3+
4+
pub struct AudioPlugin;
5+
6+
pub fn load_and_start_music(asset_server: Res<AssetServer>, audio: Res<Audio>){
7+
audio.play(asset_server.load("stellar_squeezebox.mp3"));
8+
}
9+
10+
impl Plugin for AudioPlugin{
11+
fn build(&self, app: &mut App) {
12+
app.add_startup_system(load_and_start_music);
13+
}
14+
}

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::health::HealthPlugin;
1010
use crate::network::NetworkPlugin;
1111
use crate::player::PlayerPlugin;
1212
use arena::ArenaPlugin;
13+
use audio::AudioPlugin;
1314
use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings};
1415
use bevy::core_pipeline::clear_color::ClearColorConfig;
1516
use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping};
@@ -30,6 +31,7 @@ mod game_manager;
3031
mod health;
3132
mod network;
3233
mod player;
34+
mod audio;
3335

3436
fn main() {
3537
let mut app = App::new();
@@ -53,6 +55,7 @@ fn main() {
5355
.add_plugin(ArenaPlugin)
5456
.add_plugin(CliPlugin)
5557
.add_plugin(HealthPlugin)
58+
.add_plugin(AudioPlugin)
5659
.insert_resource(Msaa::Sample8);
5760

5861
if !app.is_plugin_added::<EguiPlugin>() {

0 commit comments

Comments
 (0)