roguelike-game/src/raws.rs

19 lines
517 B
Rust
Raw Normal View History

mod item_structs;
use item_structs::Raws;
rltk::embedded_resource!(RAW_FILE, "../raws/spawns.json");
pub fn load_raws() {
let raw_data = rltk::embedding::EMBED
.lock()
.get_resource("../raws/spawns.json".to_string())
.unwrap();
let raw_string =
std::str::from_utf8(&raw_data).expect("Unable to convert to a valid UTF-8 string.");
let decoder: Raws = serde_json::from_str(&raw_string).expect("Unable to parse JSON");
rltk::console::log(format!("{:?}", decoder));
}