Fixed the flag/command line stuff

Also added it all into the command_manager thing so the App struct
doesn't look quite so busy
This commit is contained in:
2023-07-04 23:34:34 +01:00
parent 061a987060
commit 6004df73f7
2 changed files with 54 additions and 35 deletions

View File

@@ -38,10 +38,6 @@ struct RustDoomLauncher {
config_filename: PathBuf,
config_file_loaded: bool,
command_manager: CommandManager,
warp_string: String,
difficulty: Difficulty,
fast_monsters: bool,
respawning_monsters: bool,
display_command: bool,
add_stuff_window_displayed: bool,
selected_file_type: FileType,
@@ -58,10 +54,6 @@ impl Default for RustDoomLauncher {
add_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,
display_command: false,
add_stuff_window_displayed: false,
selected_file_type: FileType::Pwad,
@@ -267,42 +259,65 @@ impl eframe::App for RustDoomLauncher {
});
let mut text = "Placeholder for WAD info stuffs";
let window_size = frame.info().window_info.size;
ui.add(egui::TextEdit::multiline(&mut text).desired_width(window_size[0]/1.6).desired_rows(20));
ui.add(
egui::TextEdit::multiline(&mut text)
.desired_width(window_size[0] / 1.6)
.desired_rows(20),
);
});
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)
let r = ui.text_edit_singleline(&mut self.command_manager.warp)
.labelled_by(warp_label.id);
if r.changed() {
let _ = self.command_manager.generate_command_str();
}
});
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.horizontal(|ui| {
ui.label("difficulty");
ui.set_max_width(180.0);
eframe::egui::ComboBox::new("difficulty", "")
.selected_text(format!("{}", self.command_manager.difficulty))
.show_ui(ui, |ui| {
for diff in Difficulty::iterator() {
let r = ui.selectable_value(
&mut self.command_manager.difficulty,
*diff,
diff.to_string(),
);
if r.clicked() {
let _ = self.command_manager.generate_command_str();
}
}
});
});
ui.separator();
ui.horizontal(|ui| {
ui.label("fast");
let r = ui.add(egui::Checkbox::without_text(&mut self.command_manager.fast_monsters));
if r.clicked() {
let _ = self.command_manager.generate_command_str();
}
});
ui.separator();
ui.horizontal(|ui| {
ui.label("respawn");
let r = ui.add(egui::Checkbox::without_text(&mut self.command_manager.respawning_monsters));
if r.clicked() {
let _ = self.command_manager.generate_command_str();
}
});
});
});
ui.separator();
ui.horizontal(|ui| {
ui.label("Command");
ui.checkbox(&mut self.display_command, "");
ui.add(egui::Checkbox::without_text(&mut self.display_command));
});
ui.horizontal_wrapped(|ui| {
if let Some(l) = self.launcher_manager.get_current() {