Skip to content

Commit

Permalink
Fix map asset path
Browse files Browse the repository at this point in the history
  • Loading branch information
aleokdev committed Jan 31, 2022
1 parent bff5abf commit 0542903
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions examples/sfml/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use sfml::{
system::{Vector2f, Vector2u},
window::{ContextSettings, Key, Style},
};
use std::{path::Path, time::Duration};
use std::{env, path::PathBuf, time::Duration};
use tiled::{LayerData, LayerTile, Map};
use tilesheet::Tilesheet;

Expand Down Expand Up @@ -89,7 +89,14 @@ impl Drawable for Level {
}

fn main() {
let map = Map::parse_file(Path::new(MAP_PATH)).unwrap();
let map = Map::parse_file(
PathBuf::from(
env::var("CARGO_MANIFEST_DIR")
.expect("To run the example, use `cargo run --example sfml`"),
)
.join(MAP_PATH),
)
.unwrap();
let level = Level::from_map(map);

let mut window = create_window();
Expand Down

0 comments on commit 0542903

Please sign in to comment.