mirror of
https://github.com/lisk77/comet.git
synced 2025-12-12 17:18:50 +00:00
Compare commits
No commits in common. "bc9ea50264676a644907ee47488794e33dce327a" and "4e2c18b0c1247e991dcccf060f88d509fea71665" have entirely different histories.
bc9ea50264
...
4e2c18b0c1
4 changed files with 3 additions and 35 deletions
|
|
@ -16,7 +16,6 @@ comet_ecs = { path = "./crates/comet_ecs", workspace = true }
|
||||||
comet_input = { path = "./crates/comet_input", workspace = true }
|
comet_input = { path = "./crates/comet_input", workspace = true }
|
||||||
comet_log = { path = "./crates/comet_log", workspace = true }
|
comet_log = { path = "./crates/comet_log", workspace = true }
|
||||||
comet_structs = { path = "./crates/comet_structs", workspace = true }
|
comet_structs = { path = "./crates/comet_structs", workspace = true }
|
||||||
comet_sound = { path = "./crates/comet_sound", workspace = true }
|
|
||||||
|
|
||||||
cfg-if = "1"
|
cfg-if = "1"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
|
@ -64,4 +63,3 @@ comet_ecs = { path = "./crates/comet_ecs", workspace = true }
|
||||||
comet_input = { path = "./crates/comet_input", workspace = true }
|
comet_input = { path = "./crates/comet_input", workspace = true }
|
||||||
comet_log = { path = "./crates/comet_log", workspace = true }
|
comet_log = { path = "./crates/comet_log", workspace = true }
|
||||||
comet_structs = { path = "./crates/comet_structs", workspace = true }
|
comet_structs = { path = "./crates/comet_structs", workspace = true }
|
||||||
comet_sound = { path = "./crates/comet_sound", workspace = true }
|
|
||||||
|
|
|
||||||
|
|
@ -111,11 +111,6 @@ impl App {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_audio(mut self, audio_system: Box<dyn Audio>) -> Self {
|
|
||||||
self.audio = audio_system;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_icon(path: &std::path::Path) -> Option<Icon> {
|
fn load_icon(path: &std::path::Path) -> Option<Icon> {
|
||||||
let image = match image::open(path) {
|
let image = match image::open(path) {
|
||||||
Ok(image) => image,
|
Ok(image) => image,
|
||||||
|
|
@ -392,7 +387,8 @@ impl App {
|
||||||
match renderer.render() {
|
match renderer.render() {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(
|
Err(
|
||||||
wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated,
|
wgpu::SurfaceError::Lost
|
||||||
|
| wgpu::SurfaceError::Outdated,
|
||||||
) => {
|
) => {
|
||||||
let size = renderer.size();
|
let size = renderer.size();
|
||||||
renderer.resize(size);
|
renderer.resize(size);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
}
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue