Added the misc options

This commit is contained in:
2023-06-04 23:07:07 +01:00
parent b7500560a3
commit 9eea5d9416
2 changed files with 78 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
use serde_derive::{Deserialize, Serialize};
use std::fmt;
use std::path::PathBuf;
use std::slice::Iter;
// TODO - write some impl stuff in here so the main GUI stuff
// is a little bit more decoupled from this. I think a Display
@@ -17,3 +19,40 @@ pub struct LauncherInfo {
pub path: PathBuf,
pub name: String,
}
#[derive(PartialEq, Clone, Copy)]
pub enum Difficulty {
None,
Baby,
Easy,
Medium,
Hard,
Nightmare,
}
impl fmt::Display for Difficulty {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Difficulty::Baby => write!(f, "I'm too young to die"),
Difficulty::Easy => write!(f, "Hey, not too rough"),
Difficulty::Medium => write!(f, "Hurt me plenty"),
Difficulty::Hard => write!(f, "Ultra-Violence"),
Difficulty::Nightmare => write!(f, "Nightmare!"),
Difficulty::None => write!(f, "None"),
}
}
}
impl Difficulty {
pub fn iterator() -> Iter<'static, Difficulty> {
static DIFFICULTIES: [Difficulty; 6] = [
Difficulty::None,
Difficulty::Baby,
Difficulty::Easy,
Difficulty::Medium,
Difficulty::Hard,
Difficulty::Nightmare,
];
DIFFICULTIES.iter()
}
}