mute audio in debug builds when run through cargo run
This commit is contained in:
parent
4a5a239639
commit
7780b90e8f
2 changed files with 15 additions and 4 deletions
|
@ -17,9 +17,11 @@ Then run the following commands, replacing `[URL]` with the clone URL of the git
|
|||
```
|
||||
git clone [URL]
|
||||
cd outfly
|
||||
cargo run
|
||||
cargo run --release
|
||||
```
|
||||
|
||||
NOTE: Audio is muted by default when run through `cargo run`, unless you add `--release`
|
||||
|
||||
## Building for Windows on Linux
|
||||
|
||||
```
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use bevy::prelude::*;
|
||||
use std::env;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct Settings {
|
||||
|
@ -36,9 +37,17 @@ pub struct Settings {
|
|||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
// Mute audio by default in debug builds
|
||||
let default_mute_sfx = cfg!(debug_assertions);
|
||||
let default_mute_music = cfg!(debug_assertions);
|
||||
let default_mute_sfx;
|
||||
let default_mute_music;
|
||||
if let Ok(_) = env::var("CARGO") {
|
||||
// Mute audio by default when run through `cargo`
|
||||
default_mute_sfx = cfg!(debug_assertions);
|
||||
default_mute_music = cfg!(debug_assertions);
|
||||
}
|
||||
else {
|
||||
default_mute_sfx = false;
|
||||
default_mute_music = false;
|
||||
}
|
||||
|
||||
Settings {
|
||||
mute_sfx: default_mute_sfx,
|
||||
|
|
Loading…
Add table
Reference in a new issue