summaryrefslogtreecommitdiff
path: root/src/ui.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.rs')
-rw-r--r--src/ui.rs65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/ui.rs b/src/ui.rs
deleted file mode 100644
index 8608447..0000000
--- a/src/ui.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use egui::{Color32, Stroke, Ui, epaint::CircleShape};
-
-use crate::{Camera, Config, Diagnostics, Input, sim::materials::MaterialId};
-
-pub fn draw_egui<'a>(
- ui: &mut Ui,
- config: &mut Config,
- camera: &mut Camera,
- diagnostics: &Diagnostics,
- input: &Input,
-) {
- puffin::profile_function!();
- ui.heading("Config");
- ui.add(egui::Slider::new(&mut config.brush_radius, 1..=100).text("Brush radius"));
-
- let material = config.brush_material.def();
-
- // material combobox
- egui::ComboBox::from_label("Select a material")
- .selected_text(format!(
- "Material: [{}, d={}]",
- material.name, material.density,
- ))
- .icon(move |ui, rect, _, _| {
- ui.painter().add(egui::Shape::Circle(CircleShape {
- center: rect.center(),
- radius: rect.width() / 2.5,
- stroke: Stroke::NONE,
- fill: Color32::from_rgb(material.color.0, material.color.1, material.color.2),
- }));
- })
- .show_ui(ui, |ui| {
- for material_id in MaterialId::ALL {
- ui.selectable_value(
- &mut config.brush_material,
- material_id,
- material_id.def().name,
- );
- }
- });
-
- ui.add(egui::Slider::new(&mut config.fps, 1..=1000).text("Max FPS"));
- ui.checkbox(&mut config.use_threading, "Use multithreading");
- ui.label(format!("Real FPS: {}", diagnostics.fps));
- ui.heading("Camera");
- ui.add(egui::Slider::new(&mut camera.zoom, 0.0..=10.0).text("Zoom"));
- ui.heading("Input");
-
- input.last_mouse_pos_on_screen.map(|p| {
- ui.label(format!(
- "Mouse: x,y=({x}, {y}), lmb_pressed={lmb}",
- x = p.0,
- y = p.1,
- lmb = input.is_lmb_pressed
- ))
- });
-
- input
- .last_mouse_pos_on_board
- .map(|p| ui.label(format!("Mouse (board): x,y=({x}, {y})", x = p.0, y = p.1,)));
-
- input
- .last_mouse_pos_on_board
- .map(|p| ui.label(format!("Mouse (chunk): x,y=({x}, {y})", x = p.0, y = p.1,)));
-}