diff --git a/assets/music/Galactic_Rap.mp3 b/assets/music/Galactic_Rap.mp3 new file mode 100644 index 0000000..41e09d9 Binary files /dev/null and b/assets/music/Galactic_Rap.mp3 differ diff --git a/assets/music/Galactic_Rap.ogg b/assets/music/Galactic_Rap.ogg deleted file mode 100644 index 254e60e..0000000 Binary files a/assets/music/Galactic_Rap.ogg and /dev/null differ diff --git a/assets/music/Galactic_Rap_Destroyed.mp3 b/assets/music/Galactic_Rap_Destroyed.mp3 new file mode 100644 index 0000000..6d44bad Binary files /dev/null and b/assets/music/Galactic_Rap_Destroyed.mp3 differ diff --git a/assets/music/Galactic_Rap_Destroyed.ogg b/assets/music/Galactic_Rap_Destroyed.ogg deleted file mode 100644 index f5b3ce9..0000000 Binary files a/assets/music/Galactic_Rap_Destroyed.ogg and /dev/null differ diff --git a/assets/music/Galactic_Rap_Speedup.mp3 b/assets/music/Galactic_Rap_Speedup.mp3 new file mode 100644 index 0000000..01a2606 Binary files /dev/null and b/assets/music/Galactic_Rap_Speedup.mp3 differ diff --git a/assets/music/Galactic_Rap_Speedup.ogg b/assets/music/Galactic_Rap_Speedup.ogg deleted file mode 100644 index 58fc636..0000000 Binary files a/assets/music/Galactic_Rap_Speedup.ogg and /dev/null differ diff --git a/assets/music/Mesmerizing_Galaxy_Broken.mp3 b/assets/music/Mesmerizing_Galaxy_Broken.mp3 new file mode 100644 index 0000000..8d0320b Binary files /dev/null and b/assets/music/Mesmerizing_Galaxy_Broken.mp3 differ diff --git a/assets/music/Mesmerizing_Galaxy_Broken.ogg b/assets/music/Mesmerizing_Galaxy_Broken.ogg deleted file mode 100644 index 3639898..0000000 Binary files a/assets/music/Mesmerizing_Galaxy_Broken.ogg and /dev/null differ diff --git a/assets/music/Mesmerizing_Galaxy_Loop.mp3 b/assets/music/Mesmerizing_Galaxy_Loop.mp3 new file mode 100644 index 0000000..0f6bba3 Binary files /dev/null and b/assets/music/Mesmerizing_Galaxy_Loop.mp3 differ diff --git a/assets/music/Mesmerizing_Galaxy_Loop.ogg b/assets/music/Mesmerizing_Galaxy_Loop.ogg deleted file mode 100644 index 8ecb95c..0000000 Binary files a/assets/music/Mesmerizing_Galaxy_Loop.ogg and /dev/null differ diff --git a/assets/sounds/bzz.mp3 b/assets/sounds/bzz.mp3 new file mode 100644 index 0000000..bde2f73 Binary files /dev/null and b/assets/sounds/bzz.mp3 differ diff --git a/assets/sounds/bzz.ogg b/assets/sounds/bzz.ogg deleted file mode 100644 index 3ca30f2..0000000 Binary files a/assets/sounds/bzz.ogg and /dev/null differ diff --git a/build.rs b/build.rs index 11082bd..b218bb6 100644 --- a/build.rs +++ b/build.rs @@ -17,9 +17,6 @@ struct Assets { /// of the constant storing their png. assets: BTreeMap, - /// Sound assets. - sound_assets: BTreeMap, - /// Asset groups contained within this asset group, mapping their name to the assets /// that group contains. groups: BTreeMap> @@ -40,19 +37,15 @@ impl AssetsWriter { } } - fn asset_name>(canonical_path: P) -> String { - let mut hasher = DefaultHasher::new(); - canonical_path.as_ref().hash(&mut hasher); - let hash = hasher.finish(); - format!("ASSET_{hash:X}") - } - - fn add_png + Copy>( + fn add_png>( &mut self, canonical_path: P, png: tiny_skia::Pixmap ) -> String { - let const_name = Self::asset_name(canonical_path); + let mut hasher = DefaultHasher::new(); + canonical_path.as_ref().hash(&mut hasher); + let hash = hasher.finish(); + let const_name = format!("ASSET_{hash:X}"); let out_dir = env::var_os("OUT_DIR").unwrap(); let out_dir: PathBuf = out_dir.into(); @@ -69,18 +62,6 @@ impl AssetsWriter { const_name } - fn add_ogg + Copy>(&mut self, canonical_path: P) -> String { - let const_name = Self::asset_name(canonical_path); - writeln!(self.file, "// {}", canonical_path.as_ref().display()).unwrap(); - writeln!( - self.file, - "const {const_name}: &[u8] = include_bytes!(\"{}\");", - canonical_path.as_ref().display() - ) - .unwrap(); - const_name - } - fn finish(mut self) { fn write_assets_struct( file: &mut File, @@ -104,13 +85,6 @@ impl AssetsWriter { asset_name.to_snake_case() )?; } - for asset_name in root.sound_assets.keys() { - writeln!( - file, - "{indent}\tpub {}: comfy::Sound,", - asset_name.to_snake_case() - )?; - } for group_name in root.groups.keys() { writeln!( file, @@ -127,9 +101,6 @@ impl AssetsWriter { for asset_const_name in root.assets.values() { writeln!(file, "{indent}\t\tc.load_texture_from_bytes({asset_const_name:?}, {asset_const_name});")?; } - for asset_const_name in root.sound_assets.values() { - writeln!(file, "{indent}\t\tcomfy::load_sound_from_bytes({asset_const_name:?}, {asset_const_name}, Default::default());")?; - } for group_name in root.groups.keys() { writeln!(file, "{indent}\t\t{group_name}::Assets::load(c);")?; } @@ -147,13 +118,6 @@ impl AssetsWriter { asset_name.to_snake_case() )?; } - for (asset_name, asset_const_name) in &root.sound_assets { - writeln!( - file, - "{indent}\t{}: comfy::sound_id({asset_const_name:?}),", - asset_name.to_snake_case() - )?; - } for group_name in root.groups.keys() { writeln!( file, @@ -206,8 +170,6 @@ fn process_dir + Copy>( groups.pop(); } else if path.extension().map(|ext| ext == "svg").unwrap_or(false) { process_svg(&path, dir, writer, groups); - } else if path.extension().map(|ext| ext == "ogg").unwrap_or(false) { - process_ogg(&path, dir, writer, groups); } } } @@ -234,8 +196,7 @@ fn process_svg + Copy, Q: AsRef>( resvg::render(&tree, transform, &mut pixmap.as_mut()); let const_name = writer.add_png( - &file - .as_ref() + file.as_ref() .canonicalize() .expect("Failed to canonicalize"), pixmap @@ -257,33 +218,3 @@ fn process_svg + Copy, Q: AsRef>( const_name ); } - -fn process_ogg + Copy, Q: AsRef>( - file: P, - dir: Q, - writer: &mut AssetsWriter, - groups: &[String] -) { - let const_name = writer.add_ogg( - &file - .as_ref() - .canonicalize() - .expect("Failed to canonicalize") - ); - let mut group = &mut writer.root; - for group_name in groups { - if !group.groups.contains_key(group_name) { - group.groups.insert(group_name.to_owned(), Box::default()); - } - group = group.groups.get_mut(group_name).unwrap(); - } - group.sound_assets.insert( - file.as_ref() - .file_stem() - .expect("File doesn't have a stem") - .to_str() - .expect("Non-UTF8 file names aren't allowed") - .into(), - const_name - ); -}