Added the misc options
This commit is contained in:
39
src/infos.rs
39
src/infos.rs
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
40
src/main.rs
40
src/main.rs
@@ -1,7 +1,7 @@
|
||||
use eframe::egui;
|
||||
use std::path::PathBuf;
|
||||
use config::{default_save_filename, save_config, load_config, Config};
|
||||
use infos::{WadInfo, LauncherInfo};
|
||||
use infos::{WadInfo, LauncherInfo, Difficulty};
|
||||
|
||||
pub mod config;
|
||||
pub mod infos;
|
||||
@@ -27,6 +27,10 @@ struct RustDoomLauncher {
|
||||
name: String,
|
||||
config_filename: PathBuf,
|
||||
config_file_loaded: bool,
|
||||
warp_string: String,
|
||||
difficulty: Difficulty,
|
||||
fast_monsters: bool,
|
||||
respawning_monsters: bool,
|
||||
}
|
||||
|
||||
impl Default for RustDoomLauncher {
|
||||
@@ -41,6 +45,10 @@ impl Default for RustDoomLauncher {
|
||||
name: "".to_string(),
|
||||
config_filename: default_save_filename(),
|
||||
config_file_loaded: false,
|
||||
warp_string: String::new(),
|
||||
difficulty: Difficulty::None,
|
||||
fast_monsters: false,
|
||||
respawning_monsters: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,6 +190,36 @@ impl eframe::App for RustDoomLauncher {
|
||||
}
|
||||
});
|
||||
});
|
||||
ui.separator();
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.horizontal(|ui| {
|
||||
ui.set_max_width(180.0);
|
||||
let warp_label = ui.label("warp");
|
||||
ui.text_edit_singleline(&mut self.warp_string).labelled_by(warp_label.id);
|
||||
});
|
||||
ui.separator();
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("difficulty");
|
||||
eframe::egui::ComboBox::new("difficulty", "")
|
||||
.selected_text(format!("{}", self.difficulty))
|
||||
.show_ui(ui, |ui| {
|
||||
for diff in Difficulty::iterator() {
|
||||
ui.selectable_value(&mut self.difficulty, *diff, diff.to_string());
|
||||
}
|
||||
});
|
||||
});
|
||||
ui.separator();
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("fast");
|
||||
ui.checkbox(&mut self.fast_monsters, "");
|
||||
});
|
||||
ui.separator();
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("respawn");
|
||||
ui.checkbox(&mut self.respawning_monsters, "");
|
||||
});
|
||||
});
|
||||
ui.separator();
|
||||
ui.label("Command");
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
// I don't actually think using SelectableLabel is correct here -
|
||||
|
||||
Reference in New Issue
Block a user