nyaaa~ :3
This commit is contained in:
		
							parent
							
								
									6d97033506
								
							
						
					
					
						commit
						8aceecf045
					
				
							
								
								
									
										82
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										82
									
								
								src/main.rs
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,81 @@
 | 
			
		|||
fn main() {
 | 
			
		||||
    println!("Hello, world!");
 | 
			
		||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
 | 
			
		||||
 | 
			
		||||
use eframe::egui;
 | 
			
		||||
use std::env;
 | 
			
		||||
use std::fs;
 | 
			
		||||
use std::path::PathBuf;
 | 
			
		||||
 | 
			
		||||
fn main() -> eframe::Result {
 | 
			
		||||
    env_logger::init();
 | 
			
		||||
 | 
			
		||||
    let options = eframe::NativeOptions {
 | 
			
		||||
        viewport: egui::ViewportBuilder::default().with_inner_size([900.0, 540.0]),
 | 
			
		||||
        ..Default::default()
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    eframe::run_native(
 | 
			
		||||
        "a3lrs",
 | 
			
		||||
        options,
 | 
			
		||||
        Box::new(|cc| {
 | 
			
		||||
            egui_extras::install_image_loaders(&cc.egui_ctx);
 | 
			
		||||
            Ok(Box::<MyApp>::default())
 | 
			
		||||
        }),
 | 
			
		||||
    )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct MyApp {
 | 
			
		||||
    selected: String,
 | 
			
		||||
    presets: Vec<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Default for MyApp {
 | 
			
		||||
    fn default() -> Self {
 | 
			
		||||
        Self {
 | 
			
		||||
            selected: String::new(),
 | 
			
		||||
            presets: Vec::new(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl eframe::App for MyApp {
 | 
			
		||||
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
 | 
			
		||||
        egui::CentralPanel::default().show(ctx, |ui| {
 | 
			
		||||
 | 
			
		||||
            if self.presets.is_empty() {
 | 
			
		||||
                let home_dir = env::var("HOME").expect("HOME environment variable not set");
 | 
			
		||||
 | 
			
		||||
                let steamapps_dir = PathBuf::from(home_dir).join(".steam/debian-installation/steamapps");
 | 
			
		||||
                let preset_dir = steamapps_dir
 | 
			
		||||
                    .join("compatdata")
 | 
			
		||||
                    .join("107410")
 | 
			
		||||
                    .join("pfx")
 | 
			
		||||
                    .join("drive_c")
 | 
			
		||||
                    .join("users")
 | 
			
		||||
                    .join("steamuser")
 | 
			
		||||
                    .join("AppData")
 | 
			
		||||
                    .join("Local")
 | 
			
		||||
                    .join("Arma 3 Launcher")
 | 
			
		||||
                    .join("Presets");
 | 
			
		||||
 | 
			
		||||
                if let Ok(entries) = fs::read_dir(preset_dir) {
 | 
			
		||||
                    self.presets = entries
 | 
			
		||||
                        .filter_map(|entry| entry.ok())
 | 
			
		||||
                        .filter_map(|entry| entry.file_name().into_string().ok())
 | 
			
		||||
                        .collect();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            egui::ComboBox::from_label("Select Preset")
 | 
			
		||||
                .selected_text(&self.selected)
 | 
			
		||||
                .show_ui(ui, |ui| {
 | 
			
		||||
                    for preset in &self.presets {
 | 
			
		||||
                        ui.selectable_value(&mut self.selected, preset.clone(), preset);
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
            if ui.button("skibidi").clicked() {
 | 
			
		||||
                println!("Selected preset: {}", self.selected);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user