mirror of
https://github.com/lisk77/comet.git
synced 2025-12-12 17:18:50 +00:00
chore(examples): rename hello_sound to simple_audio and fix the links in the README
This commit is contained in:
parent
bc9ea50264
commit
c0ce4e60ee
2 changed files with 9 additions and 7 deletions
|
|
@ -1,26 +0,0 @@
|
|||
use comet::prelude::*;
|
||||
use comet_sound::Audio;
|
||||
|
||||
fn setup(app: &mut App, _renderer: &mut Renderer2D) {
|
||||
app.load_audio("startup", "res/sounds/hit.ogg");
|
||||
app.play_audio("startup", true); // second parameter loops the sound
|
||||
|
||||
// here the float indicated the volume percentage
|
||||
// in the standard backend for audio in comet (kira) 0.0 is equal to -20dB and 1.0 to 0dB
|
||||
app.set_volume("startup", 1.0);
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn update(app: &mut App, renderer: &mut Renderer2D, dt: f32) {
|
||||
// in this example, update_audio doesnt do anything because the kira audio system
|
||||
// doesnt need any update
|
||||
app.update_audio(dt);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.with_title("Comet Audio Example")
|
||||
// This can be used to add your own sound engine to the engine
|
||||
.with_audio(Box::new(comet_sound::KiraAudio::new())) // to
|
||||
.run::<Renderer2D>(setup, update);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue