mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-15 04:05:02 +01:00
Add music
This commit is contained in:
parent
20409e3ee2
commit
69b022ea02
3 changed files with 6 additions and 2 deletions
BIN
res/music.ogg
Normal file
BIN
res/music.ogg
Normal file
Binary file not shown.
|
|
@ -32,11 +32,13 @@ impl App {
|
|||
pub fn new() -> anyhow::Result<Self> {
|
||||
let rw = graphics::make_window();
|
||||
let sf_egui = SfEgui::new(&rw);
|
||||
let mut res = Res::load()?;
|
||||
res.music.play();
|
||||
Ok(Self {
|
||||
rw,
|
||||
should_quit: false,
|
||||
game: GameState::default(),
|
||||
res: Res::load()?,
|
||||
res,
|
||||
sf_egui,
|
||||
input: Input::default(),
|
||||
debug: DebugState::default(),
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
use sfml::{graphics::Texture, SfBox};
|
||||
use sfml::{audio::Music, graphics::Texture, SfBox};
|
||||
|
||||
pub struct Res {
|
||||
pub tile_atlas: SfBox<Texture>,
|
||||
pub music: Music<'static>,
|
||||
}
|
||||
|
||||
impl Res {
|
||||
pub fn load() -> anyhow::Result<Self> {
|
||||
Ok(Self {
|
||||
tile_atlas: Texture::from_file("res/tiles.png")?,
|
||||
music: Music::from_file("res/music.ogg").unwrap(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue