music; load palettes

This commit is contained in:
2021-05-18 00:05:39 +01:00
parent 5bb6760568
commit 4238ea033a
2 changed files with 43 additions and 11 deletions

18
src/music.rs Normal file
View File

@@ -0,0 +1,18 @@
use std::fs;
use std::path::PathBuf;
/// an XM music file.
/// name is derived from the file stem.
pub struct Music {
pub name: String,
pub bytes: Vec<u8>,
}
impl Music {
pub fn from_file(path: PathBuf) -> Self {
Self {
name: path.file_stem().unwrap().to_str().unwrap().into(),
bytes: fs::read(path).unwrap()
}
}
}