use boytacean_common::util::capitalize;
#[cfg(feature = "wasm")]
use wasm_bindgen::prelude::*;
#[cfg(feature = "wasm")]
use crate::gen::dependencies_map;
use crate::gen::{COMPILATION_DATE, COMPILATION_TIME, COMPILER, COMPILER_VERSION, NAME, VERSION};
#[cfg_attr(feature = "wasm", wasm_bindgen)]
pub struct Info;
#[cfg_attr(feature = "wasm", wasm_bindgen)]
impl Info {
pub fn name() -> String {
capitalize(NAME)
}
pub fn name_lower() -> String {
String::from(NAME)
}
pub fn version() -> String {
String::from(VERSION)
}
pub fn system() -> String {
String::from("Game Boy")
}
pub fn compiler() -> String {
String::from(COMPILER)
}
pub fn compiler_version() -> String {
String::from(COMPILER_VERSION)
}
pub fn compilation_date() -> String {
String::from(COMPILATION_DATE)
}
pub fn compilation_time() -> String {
String::from(COMPILATION_TIME)
}
}
#[cfg(feature = "wasm")]
#[cfg_attr(feature = "wasm", wasm_bindgen)]
impl Info {
pub fn wasm_engine() -> Option<String> {
let dependencies = dependencies_map();
if !dependencies.contains_key("wasm-bindgen") {
return None;
}
Some(format!(
"wasm-bindgen/{}",
*dependencies.get("wasm-bindgen").unwrap()
))
}
}