Skip to content

Commit

Permalink
Actually make the example work in the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
harudagondi committed Aug 1, 2022
1 parent dcb5f32 commit 8efed7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ A third party Bevy plugin that integrates [`oddio`] into [Bevy].

## Usage

```rust
```rust no_run
use bevy::prelude::*;
use bevy_oddio::*;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(AudioPlugin)
.add_startup_system()
.add_startup_system(play_background_audio)
.run();
}

fn play_background_audio(asset_server: Res<AssetServer>, audio: Res<Audio>) {
audio.play(asset_server.load("background_audio.wav"));
fn play_background_audio(asset_server: Res<AssetServer>, mut audio: ResMut<Audio>) {
audio.play(asset_server.load("background_audio.wav"), 0.0);
}
```

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,7 @@ impl AudioApp for App {
.add_system_to_stage(CoreStage::PostUpdate, play_queued_audio::<Source>)
}
}

#[doc = include_str!("../README.md")]
#[cfg(doctest)]
struct DocTestsForReadMe; // Only used for testing code blocks in README.md

0 comments on commit 8efed7d

Please sign in to comment.