mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-17 04:45: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> {
|
pub fn new() -> anyhow::Result<Self> {
|
||||||
let rw = graphics::make_window();
|
let rw = graphics::make_window();
|
||||||
let sf_egui = SfEgui::new(&rw);
|
let sf_egui = SfEgui::new(&rw);
|
||||||
|
let mut res = Res::load()?;
|
||||||
|
res.music.play();
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
rw,
|
rw,
|
||||||
should_quit: false,
|
should_quit: false,
|
||||||
game: GameState::default(),
|
game: GameState::default(),
|
||||||
res: Res::load()?,
|
res,
|
||||||
sf_egui,
|
sf_egui,
|
||||||
input: Input::default(),
|
input: Input::default(),
|
||||||
debug: DebugState::default(),
|
debug: DebugState::default(),
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
use sfml::{graphics::Texture, SfBox};
|
use sfml::{audio::Music, graphics::Texture, SfBox};
|
||||||
|
|
||||||
pub struct Res {
|
pub struct Res {
|
||||||
pub tile_atlas: SfBox<Texture>,
|
pub tile_atlas: SfBox<Texture>,
|
||||||
|
pub music: Music<'static>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Res {
|
impl Res {
|
||||||
pub fn load() -> anyhow::Result<Self> {
|
pub fn load() -> anyhow::Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
tile_atlas: Texture::from_file("res/tiles.png")?,
|
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