Compare commits
2 Commits
1bbfaceeb4
...
46f8831c7b
Author | SHA1 | Date |
---|---|---|
Max Bradbury | 46f8831c7b | |
Max Bradbury | 66cb9bdd4d |
|
@ -27,6 +27,7 @@ pub enum Error {
|
||||||
Dialogue,
|
Dialogue,
|
||||||
Ending,
|
Ending,
|
||||||
Exit,
|
Exit,
|
||||||
|
Font,
|
||||||
Game {
|
Game {
|
||||||
missing: NotFound,
|
missing: NotFound,
|
||||||
},
|
},
|
||||||
|
|
|
@ -255,7 +255,7 @@ impl Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! avatar_exists {
|
if ! avatar_exists {
|
||||||
warnings.push(crate::Error::Game { missing: NotFound::Avatar});
|
warnings.push(crate::Error::Game { missing: NotFound::Avatar });
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(
|
Ok(
|
||||||
|
|
|
@ -51,9 +51,7 @@ impl Sprite {
|
||||||
format!("\n{}", lines.join("\n"))
|
format!("\n{}", lines.join("\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl Sprite {
|
|
||||||
pub fn from_str(str: &str) -> Result<Sprite, crate::Error> {
|
pub fn from_str(str: &str) -> Result<Sprite, crate::Error> {
|
||||||
let mut lines: Vec<&str> = str.lines().collect();
|
let mut lines: Vec<&str> = str.lines().collect();
|
||||||
|
|
||||||
|
|
14
src/text.rs
14
src/text.rs
|
@ -13,19 +13,19 @@ impl Font {
|
||||||
match str {
|
match str {
|
||||||
"unicode_european_small" => Font::UnicodeEuropeanSmall,
|
"unicode_european_small" => Font::UnicodeEuropeanSmall,
|
||||||
"unicode_european_large" => Font::UnicodeEuropeanLarge,
|
"unicode_european_large" => Font::UnicodeEuropeanLarge,
|
||||||
"unicode_asian" => Font::UnicodeAsian,
|
"unicode_asian" => Font::UnicodeAsian,
|
||||||
"arabic" => Font::Arabic,
|
"arabic" => Font::Arabic,
|
||||||
_ => Font::Custom,
|
_ => Font::Custom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn to_string(&self) -> Result<String, &'static str> {
|
pub(crate) fn to_string(&self) -> Result<String, crate::Error> {
|
||||||
match &self {
|
match &self {
|
||||||
Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()),
|
Font::UnicodeEuropeanSmall => Ok("unicode_european_small".to_string()),
|
||||||
Font::UnicodeEuropeanLarge => Ok("unicode_european_large".to_string()),
|
Font::UnicodeEuropeanLarge => Ok("unicode_european_large".to_string()),
|
||||||
Font::UnicodeAsian => Ok("unicode_asian".to_string()),
|
Font::UnicodeAsian => Ok("unicode_asian".to_string()),
|
||||||
Font::Arabic => Ok("arabic".to_string()),
|
Font::Arabic => Ok("arabic".to_string()),
|
||||||
_ => Err("No string available for this Font"),
|
_ => Err(crate::Error::Font),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue